@needle-tools/engine 4.7.3-next.65e7878 → 4.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/gltf-progressive-BMJtMiwp.js +1204 -0
- package/dist/gltf-progressive-DMJSXxbo.umd.cjs +8 -0
- package/dist/gltf-progressive-zQ2CaD2H.min.js +8 -0
- package/dist/{needle-engine.bundle-B0QYYufM.js → needle-engine.bundle-BxHtcHHV.js} +37 -11
- package/dist/{needle-engine.bundle-BCAZfCyl.min.js → needle-engine.bundle-DItBuJY3.min.js} +7 -7
- package/dist/{needle-engine.bundle-C6yScKUU.umd.cjs → needle-engine.bundle-DM_LxEPT.umd.cjs} +8 -8
- package/dist/needle-engine.js +3 -3
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-TkXiVrjY.min.js → postprocessing-BzY0H7ry.min.js} +8 -8
- package/dist/{postprocessing-CNCT892s.umd.cjs → postprocessing-Dw2OCMp4.umd.cjs} +8 -8
- package/dist/{postprocessing-qvgDnYKK.js → postprocessing-vKBVFpSz.js} +9 -9
- package/lib/engine/engine_lods.js +1 -1
- package/lib/engine/engine_lods.js.map +1 -1
- package/lib/engine-components/OrbitControls.d.ts +19 -1
- package/lib/engine-components/OrbitControls.js +30 -1
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
- package/lib/engine-components/postprocessing/Volume.d.ts +3 -1
- package/lib/engine-components/postprocessing/Volume.js +2 -0
- package/lib/engine-components/postprocessing/Volume.js.map +1 -1
- package/package.json +3 -3
- package/plugins/vite/logger.client.js +68 -30
- package/plugins/vite/logger.js +5 -5
- package/src/engine/engine_lods.ts +3 -3
- package/src/engine-components/OrbitControls.ts +34 -2
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +1 -1
- package/src/engine-components/postprocessing/Volume.ts +2 -1
- package/dist/gltf-progressive-BCZdu3Gc.min.js +0 -8
- package/dist/gltf-progressive-C6QbvrB4.umd.cjs +0 -8
- package/dist/gltf-progressive-CCddD-3B.js +0 -1159
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var RC=Object.defineProperty,Mv=n=>{throw TypeError(n)},TC=(n,e,t)=>e in n?RC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,a=(n,e,t)=>TC(n,typeof e!="symbol"?e+"":e,t),Mm=(n,e,t)=>e.has(n)||Mv("Cannot "+t),ge=(n,e,t)=>(Mm(n,e,"read from private field"),t?t.call(n):e.get(n)),Fs=(n,e,t)=>e.has(n)?Mv("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Us=(n,e,t,s)=>(Mm(n,e,"write to private field"),s?s.call(n,t):e.set(n,t),t),ud=(n,e,t)=>(Mm(n,e,"access private method"),t);import{Vector2 as ie,Vector3 as S,Vector4 as fe,Quaternion as V,PlaneGeometry as zs,WebGLRenderer as gr,PerspectiveCamera as we,OrthographicCamera as pd,Scene as Si,Mesh as q,Texture as je,Uniform$1 as Qi,Color as re,ShaderMaterial as Ns,Box3 as Ci,ShadowMaterial as Rv,Euler as Dt,MeshStandardMaterial as bt,Box3Helper as EC,GridHelper as Rm,Object3D as A,Material as Pe,Matrix3 as Tv,Matrix4 as ne,Layers as po,Ray as mo,MathUtils as Cn,AxesHelper as Pi,MeshBasicMaterial as Me,DoubleSide as Oi,BufferGeometry as Ws,Group as go,CylinderGeometry as Ev,SphereGeometry as md,BoxGeometry as xa,SpriteMaterial as AC,Sprite as IC,Shape as LC,ExtrudeGeometry as jC,Fog as Av,DirectionalLight as Tm,PointLight as Em,EdgesGeometry as DC,LineSegments as Iv,LineBasicMaterial as Lv,Line as Hl,BufferAttribute as _t,Raycaster as gd,Sphere as fd,ArrayCamera as BC,Plane as fr,SkinnedMesh as Pn,InterleavedBufferAttribute as jv,Skeleton as FC,Bone as UC,Source as zC,WebGLCubeRenderTarget as NC,CubeCamera as WC,AnimationClip as fo,FileLoader as Am,TextureLoader as Sa,PropertyBinding as Ca,LinearSRGBColorSpace as On,ShaderChunk as qt,UniformsLib as VC,DataTexture as Im,RGBAFormat as yd,EquirectangularReflectionMapping as kn,SRGBColorSpace as Mn,Clock as $C,NeutralToneMapping as Pa,AgXToneMapping as vd,ACESFilmicToneMapping as bd,NoToneMapping as _d,PCFSoftShadowMap$1 as HC,BasicNodeLibrary as GC,WebGLRenderTarget as Vs,DepthTexture as Dv,NearestFilter as wd,LoopRepeat as qC,LoopOnce as Lm,AnimationMixer as jm,CompressedTexture as XC,FrontSide as yo,Camera as QC,Frustum as Bv,AudioListener as YC,PositionalAudio as KC,AudioLoader as Dm,EventDispatcher as Bm,BackSide as xd,MeshDepthMaterial as ZC,CustomBlending as JC,MaxEquation as eP,AmbientLight as tP,HemisphereLight as iP,AlwaysStencilFunc as sP,GreaterEqualStencilFunc as nP,NotEqualStencilFunc as oP,GreaterStencilFunc as rP,LessEqualStencilFunc as aP,EqualStencilFunc as lP,LessStencilFunc as cP,NeverStencilFunc as Fv,InvertStencilOp as hP,DecrementWrapStencilOp as dP,IncrementWrapStencilOp as uP,DecrementStencilOp as pP,IncrementStencilOp as mP,ReplaceStencilOp as gP,ZeroStencilOp as fP,KeepStencilOp as yP,RawShaderMaterial as Uv,GLSL3 as vP,AlwaysDepth as bP,GreaterEqualDepth as _P,GreaterDepth as wP,LessEqualDepth as xP,LessDepth as SP,NotEqualDepth as CP,EqualDepth as PP,BatchedMesh as zv,MeshPhysicalMaterial as Fm,LinearFilter as Sd,UnsignedByteType as OP,RingGeometry as kP,Line3 as MP,AdditiveBlending as Nv,BoxHelper as RP,SpotLight as TP,DirectionalLightHelper as EP,CameraHelper as AP,LOD as IP,Triangle as LP,NormalBlending as jP,ReinhardToneMapping as Um,LinearToneMapping as zm,HalfFloatType as Nm,VideoTexture as DP,CubeTexture as BP,CompressedCubeTexture as FP,EquirectangularRefractionMapping as UP,VectorKeyframeTrack as zP,QuaternionKeyframeTrack as NP,Audio as WP,ShaderLib as Cd,UniformsUtils as Wv,MirroredRepeatWrapping as Vv,MeshNormalMaterial as VP,AudioContext as $P,PMREMGenerator$1 as HP}from"./three-DuDKwKB8.min.js";import{createLoaders as Wm,getRaycastMesh as $v,LODsManager as Oa,NEEDLE_progressive as Xe,addDracoAndKTX2Loaders as GP,configureLoader as qP,setKTX2TranscoderLocation as XP,setDracoDecoderLocation as QP}from"./gltf-progressive-BCZdu3Gc.min.js";import{GroundedSkybox as ka,Font as YP,TextGeometry as KP,FontLoader as ZP,GLTFLoader as Rn,TransformControlsGizmo as Hv,EXRLoader as Pd,RGBELoader as Vm,Stats as JP,nodeFrame as eO,OrbitControls as Gv,PositionalAudioHelper as tO,HorizontalBlurShader as iO,VerticalBlurShader as sO,GLTFExporter as qv,strToU8 as Xv,zipSync as nO,XRControllerModelFactory as oO,XRHandMeshModel as rO,Line2 as aO,LineGeometry as lO,LineMaterial as cO,KTX2Loader as hO,TransformControls as dO,InteractiveGroup as uO,HTMLMesh as pO,VertexNormalsHelper as mO,OBJLoader as $m,FBXLoader as Qv,mergeVertices as gO}from"./three-examples-BMOhDaYR.min.js";import{fetchProfile as fO,MotionController as yO,$70d766613f57b014$export$2e2bcd8739ae039 as Yv,ByteBuffer as vO,v5 as Kv,md5 as Zv,SIZE_PREFIX_LENGTH as Jv,Builder as Hm,createNoise4D as bO,Matrix4 as Gm,BatchedParticleRenderer as _O,ParticleSystem as wO,RenderMode as Tn,ConstantColor as xO,Vector4 as SO,ConstantValue as CO,TrailParticle as eb,WorkerBase as PO,MeshBVH as OO}from"./vendor-BlSxe9JJ.min.js";import{__webpack_exports__default as Re,__webpack_exports__Text as tb,__webpack_exports__Block as ib,__webpack_exports__update as kO,SimpleStateBehavior as MO,__webpack_exports__Inline as qm,__webpack_exports__FontLibrary as sb,ThreeMeshUI as nb}from"./three-mesh-ui-B3p3gyUz.min.js";import{EffectAttribute as RO}from"./postprocessing-TkXiVrjY.min.js";const Xm=new Map;function Xt(n=(e=>(e=globalThis.location)==null?void 0:e.hostname)()){if(Xm.has(n))return Xm.get(n);const e=/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|localhost/.test(n);return Xm.set(n,e),e===!0}function ob(){return window.location.hostname.includes("glitch.me")}const TO='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 160 187.74"><defs><linearGradient id="a" x1="89.64" y1="184.81" x2="90.48" y2="21.85" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#62d399"/><stop offset=".51" stop-color="#acd842"/><stop offset=".9" stop-color="#d7db0a"/></linearGradient><linearGradient id="b" x1="69.68" y1="178.9" x2="68.08" y2="16.77" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0ba398"/><stop offset=".5" stop-color="#4ca352"/><stop offset="1" stop-color="#76a30a"/></linearGradient><linearGradient id="c" x1="36.6" y1="152.17" x2="34.7" y2="84.19" gradientUnits="userSpaceOnUse"><stop offset=".19" stop-color="#36a382"/><stop offset=".54" stop-color="#49a459"/><stop offset="1" stop-color="#76a30b"/></linearGradient><linearGradient id="d" x1="15.82" y1="153.24" x2="18" y2="90.86" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#267880"/><stop offset=".51" stop-color="#457a5c"/><stop offset="1" stop-color="#717516"/></linearGradient><linearGradient id="e" x1="135.08" y1="135.43" x2="148.93" y2="63.47" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#b0d939"/><stop offset="1" stop-color="#eadb04"/></linearGradient><linearGradient id="f" x1="-4163.25" y1="2285.12" x2="-4160.81" y2="2215.34" gradientTransform="rotate(20 4088.49 13316.712)" gradientUnits="userSpaceOnUse"><stop offset=".17" stop-color="#74af52"/><stop offset=".48" stop-color="#99be32"/><stop offset="1" stop-color="#c0c40a"/></linearGradient><symbol id="g" viewBox="0 0 160 187.74"><path style="fill:url(#a)" d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75z"/><path style="fill:url(#b)" d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98z"/><path style="fill:url(#c)" d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z"/><path style="fill:url(#d)" d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04z"/><path style="fill:#9c3" d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5z"/><path style="fill:url(#e)" d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59z"/><path style="fill:url(#f)" d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z"/><path style="fill:#ffe113" d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1z"/><path style="fill:#f3e600" d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75z"/></symbol></defs><use width="160" height="187.74" xlink:href="#g"/></svg>',EO=btoa(TO),AO="data:image/svg+xml;base64,"+EO,rb=AO,IO=`<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'> <svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" version="1.1" viewBox="0 0 1014 282" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m665.95 132.73v44.88l-10.56-8.4c-0.8-0.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18 0.4-6.06 1.2s-3.54 1.8-4.98 3-2.56 2.5-3.36 3.9-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c0.32 0.24 0.56 0.44 0.72 0.6s0.36 0.32 0.6 0.48c0.96-1.2 2.14-2.28 3.54-3.24s2.92-1.76 4.56-2.4 3.34-1.14 5.1-1.5 3.44-0.54 5.04-0.54c1.44 0 2.92 0.04 4.44 0.12s2.84 0.28 3.96 0.6c4.56 1.12 7.8 3.12 9.72 6s2.88 6.56 2.88 11.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m732.38 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m795.93 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m858.57 97.21c0.64 0.48 0.96 1.16 0.96 2.04v74.88c-0.08 1.04-0.12 2.12-0.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18s-2.06-1.66-2.46-1.98c-1.76 2.48-4.26 4.44-7.5 5.88s-7.02 2.16-11.34 2.16c-3.84 0-7.4-0.7-10.68-2.1s-6.14-3.44-8.58-6.12-4.34-5.94-5.7-9.78-2.04-8.16-2.04-12.96c0-4.32 0.78-8.34 2.34-12.06s3.6-6.92 6.12-9.6 5.38-4.78 8.58-6.3 6.48-2.28 9.84-2.28c2.56 0 4.82 0.22 6.78 0.66s3.68 1.06 5.16 1.86 2.78 1.74 3.9 2.82 2.16 2.22 3.12 3.42v-35.04l10.68 8.64zm-27.96 67.92c3.6 0 6.52-0.68 8.76-2.04s3.98-3.06 5.22-5.1 2.1-4.22 2.58-6.54 0.72-4.44 0.72-6.36v-1.2c0-1.12-0.22-2.7-0.66-4.74s-1.28-4.06-2.52-6.06-3-3.7-5.28-5.1-5.22-2.02-8.82-1.86c-3.44 0-6.26 0.74-8.46 2.22s-3.96 3.26-5.28 5.34-2.24 4.2-2.76 6.36-0.78 3.92-0.78 5.28c0 1.84 0.24 3.92 0.72 6.24s1.36 4.48 2.64 6.48 3.04 3.68 5.28 5.04 5.12 2.04 8.64 2.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m882.81 97.09c0.64 0.48 0.96 1.12 0.96 1.92l-0.12 41.04v37.08l-10.56-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-77.88l10.8 8.64z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m950.36 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.8559 0 0 .7642 45.348 36.475)"> <g transform="translate(2.7114)"> <path d="m3.935 173.02c-0.331 0-0.497-0.402-0.497-1.207v-51.002c0-0.738 0.138-1.107 0.414-1.107h1.781c0.277 0 0.415 0.335 0.415 1.006v5.935c0 0.336 0.027 0.553 0.083 0.654 0.055 0.101 0.151-0.017 0.289-0.352 0.912-1.744 1.754-3.236 2.527-4.477 0.773-1.24 1.554-2.179 2.341-2.816s1.65-0.956 2.588-0.956c1.685 0 3.011 0.922 3.977 2.766 0.967 1.845 1.602 3.84 1.905 5.986 0.056 0.268 0.139 0.369 0.249 0.302s0.221-0.235 0.331-0.503c0.939-1.811 1.802-3.353 2.589-4.628 0.787-1.274 1.581-2.246 2.382-2.917s1.671-1.006 2.61-1.006c2.016 0 3.569 1.392 4.66 4.175 1.09 2.783 1.636 6.421 1.636 10.915v37.925c0 0.871-0.18 1.307-0.539 1.307h-1.739c-0.138 0-0.249-0.1-0.332-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.338-6.321-1.015-8.3-0.676-1.978-1.76-2.967-3.251-2.967-0.884 0-1.726 0.386-2.527 1.157s-1.519 1.727-2.154 2.867-1.201 2.213-1.699 3.219c-0.248 0.469-0.421 0.905-0.517 1.308-0.097 0.402-0.145 0.972-0.145 1.71v37.221c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.166 0-0.29-0.1-0.373-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.332-6.321-0.994-8.3-0.663-1.978-1.754-2.967-3.273-2.967-1.242 0-2.375 0.704-3.396 2.112-1.022 1.409-2.223 3.555-3.604 6.439v39.031c0 0.805-0.18 1.207-0.539 1.207h-1.698z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m53.642 166.28c-1.077 2.549-2.237 4.477-3.479 5.785-1.243 1.307-2.61 1.961-4.101 1.961-2.154 0-3.853-1.324-5.095-3.973-1.243-2.649-1.864-6.187-1.864-10.613 0-3.488 0.4-6.489 1.201-9.004s1.988-4.51 3.562-5.985c1.574-1.476 3.521-2.414 5.841-2.817l3.686-0.704c0.221-0.067 0.394-0.218 0.518-0.453 0.124-0.234 0.187-0.587 0.187-1.056v-2.917c0-3.89-0.504-6.975-1.512-9.255s-2.354-3.42-4.039-3.42c-1.298 0-2.472 0.72-3.521 2.162s-2.002 3.572-2.858 6.388c-0.083 0.268-0.159 0.453-0.228 0.554-0.069 0.1-0.172 0.083-0.311-0.051l-1.698-1.71c-0.083-0.134-0.138-0.285-0.166-0.453-0.027-0.167 0.014-0.452 0.125-0.855 0.856-3.353 2.009-6.052 3.459-8.098 1.449-2.045 3.224-3.068 5.322-3.068 1.74 0 3.211 0.687 4.412 2.062s2.112 3.37 2.734 5.986c0.621 2.615 0.932 5.7 0.932 9.255v35.712c0 0.536-0.035 0.888-0.104 1.056s-0.2 0.251-0.393 0.251h-1.533c-0.166 0-0.29-0.117-0.373-0.352-0.083-0.234-0.124-0.553-0.124-0.955l-0.083-5.231c-0.055-0.939-0.221-1.006-0.497-0.202zm0.456-19.314c0-1.14-0.194-1.643-0.58-1.509l-3.107 0.603c-1.436 0.202-2.686 0.638-3.749 1.308-1.063 0.671-1.953 1.543-2.671 2.616s-1.257 2.33-1.616 3.772-0.538 3.102-0.538 4.98c0 3.152 0.455 5.616 1.367 7.393 0.911 1.778 2.14 2.666 3.686 2.666 0.939 0 1.85-0.419 2.734-1.257s1.671-1.895 2.361-3.169c0.663-1.408 1.181-2.85 1.553-4.326 0.373-1.475 0.56-2.883 0.56-4.225v-8.852z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m79.034 173.02c-0.166 0-0.297-0.117-0.394-0.352-0.096-0.234-0.145-0.553-0.145-0.955v-4.628c0-0.536-0.041-0.838-0.124-0.905s-0.207 0.1-0.373 0.503c-0.276 0.67-0.69 1.593-1.242 2.766-0.553 1.174-1.271 2.23-2.154 3.169-0.884 0.939-1.961 1.408-3.231 1.408-1.74 0-3.314-0.989-4.722-2.967-1.409-1.979-2.534-4.963-3.376-8.953-0.843-3.991-1.264-8.937-1.264-14.838 0-5.701 0.415-10.68 1.243-14.939s1.988-7.595 3.479-10.009c1.492-2.415 3.204-3.622 5.137-3.622 1.436 0 2.616 0.57 3.541 1.71 0.926 1.14 1.719 2.381 2.382 3.722 0.249 0.47 0.414 0.637 0.497 0.503s0.125-0.536 0.125-1.207v-23.841c0-0.805 0.151-1.208 0.455-1.208h1.864c0.276 0 0.414 0.369 0.414 1.107v72.128c0 0.537-0.041 0.905-0.124 1.107-0.083 0.201-0.235 0.301-0.455 0.301h-1.533zm-0.621-42.049c-0.939-2.213-1.885-3.94-2.838-5.181s-2.009-1.861-3.169-1.861c-1.463 0-2.768 0.889-3.914 2.666s-2.044 4.376-2.693 7.796-0.973 7.578-0.973 12.474c0 5.097 0.338 9.272 1.015 12.524 0.676 3.253 1.567 5.651 2.672 7.193 1.104 1.543 2.305 2.314 3.603 2.314 1.188 0 2.258-0.704 3.211-2.113 0.952-1.408 1.705-3.118 2.257-5.13s0.829-3.957 0.829-5.835v-24.847z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m89.514 149.38c0 3.42 0.345 6.606 1.035 9.557 0.691 2.951 1.609 5.315 2.755 7.092s2.437 2.666 3.873 2.666c1.519 0 2.837-0.738 3.956-2.213 1.118-1.476 2.064-3.655 2.837-6.539 0.083-0.336 0.166-0.52 0.249-0.554 0.083-0.033 0.179 0.017 0.29 0.151l1.408 1.912c0.221 0.268 0.235 0.67 0.041 1.207-0.69 2.548-1.47 4.661-2.34 6.337-0.87 1.677-1.857 2.935-2.962 3.773-1.104 0.838-2.319 1.257-3.645 1.257-2.043 0-3.838-1.14-5.385-3.42-1.546-2.28-2.761-5.482-3.645-9.607-0.884-4.124-1.325-8.836-1.325-14.134 0-5.901 0.455-10.931 1.367-15.089 0.911-4.158 2.14-7.377 3.686-9.658 1.547-2.28 3.3-3.42 5.261-3.42 1.988 0 3.714 1.073 5.178 3.219 1.463 2.146 2.595 5.231 3.396 9.255s1.201 8.886 1.201 14.587c0 0.469-0.02 0.939-0.062 1.408-0.041 0.469-0.214 0.704-0.517 0.704h-16.362c-0.083 0-0.152 0.151-0.207 0.453-0.056 0.302-0.083 0.654-0.083 1.056zm13.752-6.237c0.304 0 0.497-0.1 0.58-0.302 0.083-0.201 0.124-0.57 0.124-1.106 0-3.219-0.283-6.187-0.849-8.903s-1.367-4.896-2.402-6.539c-1.036-1.643-2.272-2.464-3.708-2.464-1.629 0-2.996 0.955-4.101 2.867-1.104 1.911-1.94 4.342-2.506 7.293s-0.849 6.002-0.849 9.154h13.711z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m148.54 119.7c0.165 0 0.283 0.117 0.352 0.352s0.076 0.52 0.02 0.855l-6.254 50.902c-0.028 0.47-0.104 0.788-0.228 0.956s-0.297 0.251-0.518 0.251h-1.615c-0.442 0-0.718-0.402-0.829-1.207l-5.26-40.138c-0.111-0.604-0.201-0.905-0.27-0.905s-0.131 0.301-0.186 0.905l-5.012 40.138c-0.028 0.47-0.097 0.788-0.207 0.956-0.111 0.168-0.277 0.251-0.497 0.251h-1.74c-0.442 0-0.718-0.402-0.829-1.207l-6.503-50.801c-0.055-0.403-0.048-0.721 0.021-0.956s0.2-0.352 0.393-0.352h1.823c0.166 0 0.297 0.067 0.393 0.201 0.097 0.134 0.159 0.403 0.187 0.805l5.302 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.219-41.949c0.055-0.268 0.124-0.47 0.207-0.604s0.193-0.201 0.331-0.201h1.533c0.138 0 0.262 0.067 0.373 0.201 0.11 0.134 0.179 0.403 0.207 0.805l5.468 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.053-41.849c0.055-0.335 0.138-0.57 0.249-0.704 0.11-0.134 0.234-0.201 0.373-0.201h1.284z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m156.49 171.51c0 0.604-0.042 1.006-0.125 1.208-0.082 0.201-0.262 0.301-0.538 0.301h-1.533c-0.221 0-0.366-0.083-0.435-0.251s-0.103-0.486-0.103-0.956v-50.902c0-0.805 0.152-1.207 0.456-1.207h1.822c0.304 0 0.456 0.402 0.456 1.207v50.6zm0.165-63.979c0 1.207-0.207 1.811-0.621 1.811h-1.905c-0.221 0-0.366-0.135-0.435-0.403s-0.104-0.67-0.104-1.207v-7.847c0-1.006 0.18-1.509 0.539-1.509h1.988c0.359 0 0.538 0.47 0.538 1.409v7.746z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m168.3 124.83c-0.221 0-0.331 0.269-0.331 0.805v33.801c0 3.42 0.221 5.667 0.663 6.74 0.441 1.073 1.09 1.609 1.946 1.609h3.024c0.138 0 0.242 0.084 0.311 0.252 0.069 0.167 0.103 0.419 0.103 0.754v2.716c0 0.537-0.138 0.906-0.414 1.107-0.248 0.067-0.614 0.134-1.098 0.201-0.483 0.067-0.959 0.118-1.429 0.151-0.469 0.034-0.828 0.05-1.077 0.05-1.712 0-2.934-0.955-3.665-2.867-0.732-1.911-1.098-5.013-1.098-9.305v-35.108c0-0.604-0.124-0.906-0.373-0.906h-3.521c-0.248 0-0.373-0.268-0.373-0.804v-3.521c0-0.537 0.111-0.805 0.332-0.805h3.686c0.166 0 0.263-0.268 0.29-0.805l0.415-16.095c0-0.805 0.124-1.207 0.372-1.207h1.492c0.303 0 0.455 0.436 0.455 1.307v15.995c0 0.537 0.097 0.805 0.29 0.805h5.468c0.221 0 0.331 0.268 0.331 0.805v3.521c0 0.536-0.124 0.804-0.373 0.804h-5.426z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m179.4 173.02c-0.331 0-0.497-0.402-0.497-1.207v-72.329c0-0.738 0.138-1.107 0.414-1.107h1.782c0.276 0 0.414 0.336 0.414 1.006v27.162c0 0.335 0.034 0.536 0.103 0.603s0.159-0.033 0.27-0.302c0.994-1.81 1.898-3.319 2.713-4.526 0.814-1.208 1.629-2.113 2.444-2.717 0.814-0.603 1.691-0.905 2.63-0.905 2.182 0 3.839 1.375 4.971 4.125 1.132 2.749 1.698 6.404 1.698 10.965v37.925c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.165 0-0.29-0.1-0.373-0.301-0.082-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.366-6.321-1.097-8.3-0.732-1.978-1.899-2.967-3.501-2.967-0.883 0-1.705 0.318-2.464 0.956-0.76 0.637-1.526 1.576-2.299 2.816-0.773 1.241-1.643 2.834-2.61 4.779v39.031c0 0.805-0.179 1.207-0.538 1.207h-1.699z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> </g> <g transform="matrix(.80638 0 0 .80638 452.53 65.421)" fill-rule="nonzero"> <path d="m79.32 36.98v150.76l15.68-13.2 6.59-156.31-22.27 18.75z" fill="url(#f)"/> <path d="m79.32 36.98-22.27-18.75 6.59 156.31 15.68 13.2v-150.76z" fill="url(#e)"/> <path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z" fill="url(#d)"/> <path d="m25.19 104.83-25.19-14.59 16.97 53.86 16.85 9.77-8.63-49.04z" fill="url(#c)"/> <path d="M43.86,82.5L18.69,67.98L0,90.24L25.18,104.83L43.86,82.5Z" fill="#9c3"/> <path d="m134.82 78.69-9.97 56.5 15.58-9.04 19.57-62.05-25.18 14.59z" fill="url(#b)"/> <path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z" fill="url(#a)"/> <path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33 25.19-14.59z" fill="#ffe113"/> <path d="M101.59,18.23L79.32,0L57.05,18.23L79.32,36.98L101.59,18.23Z" fill="#f3e600"/> </g> <defs> <linearGradient id="f" x2="1" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)" gradientUnits="userSpaceOnUse"><stop stop-color="#62d399" offset="0"/><stop stop-color="#acd842" offset=".51"/><stop stop-color="#d7db0a" offset=".9"/><stop stop-color="#d7db0a" offset="1"/></linearGradient> <linearGradient id="e" x2="1" gradientTransform="matrix(-1.6,-162.13,162.13,-1.6,69.68,178.9)" gradientUnits="userSpaceOnUse"><stop stop-color="#0ba398" offset="0"/><stop stop-color="#4ca352" offset=".5"/><stop stop-color="#76a30a" offset="1"/></linearGradient> <linearGradient id="d" x2="1" gradientTransform="matrix(-1.9,-67.98,67.98,-1.9,36.6,152.17)" gradientUnits="userSpaceOnUse"><stop stop-color="#36a382" offset="0"/><stop stop-color="#36a382" offset=".19"/><stop stop-color="#49a459" offset=".54"/><stop stop-color="#76a30b" offset="1"/></linearGradient> <linearGradient id="c" x2="1" gradientTransform="matrix(2.18,-62.38,62.38,2.18,15.82,153.24)" gradientUnits="userSpaceOnUse"><stop stop-color="#267880" offset="0"/><stop stop-color="#457a5c" offset=".51"/><stop stop-color="#717516" offset="1"/></linearGradient> <linearGradient id="b" x2="1" gradientTransform="matrix(13.85,-71.96,71.96,13.85,135.08,135.43)" gradientUnits="userSpaceOnUse"><stop stop-color="#b0d939" offset="0"/><stop stop-color="#eadb04" offset="1"/></linearGradient> <linearGradient id="a" x2="1" gradientTransform="matrix(26.159 -64.737 64.737 26.159 107.42 128.14)" gradientUnits="userSpaceOnUse"><stop stop-color="#74af52" offset="0"/><stop stop-color="#74af52" offset=".17"/><stop stop-color="#99be32" offset=".48"/><stop stop-color="#c0c40a" offset="1"/></linearGradient> </defs> </svg>`;btoa(IO);const LO='<svg viewBox="0 0 509 154" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M665.95 132.73v44.88l-10.56-8.4c-.8-.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18.4-6.06 1.2-1.88.8-3.54 1.8-4.98 3-1.44 1.2-2.56 2.5-3.36 3.9-.8 1.4-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-.72-.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c.32.24.56.44.72.6.16.16.36.32.6.48.96-1.2 2.14-2.28 3.54-3.24 1.4-.96 2.92-1.76 4.56-2.4 1.64-.64 3.34-1.14 5.1-1.5 1.76-.36 3.44-.54 5.04-.54 1.44 0 2.92.04 4.44.12 1.52.08 2.84.28 3.96.6 4.56 1.12 7.8 3.12 9.72 6 1.92 2.88 2.88 6.56 2.88 11.04ZM732.38 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM795.93 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM858.57 97.21c.64.48.96 1.16.96 2.04v74.88c-.08 1.04-.12 2.12-.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18-1.24-1-2.06-1.66-2.46-1.98-1.76 2.48-4.26 4.44-7.5 5.88-3.24 1.44-7.02 2.16-11.34 2.16-3.84 0-7.4-.7-10.68-2.1-3.28-1.4-6.14-3.44-8.58-6.12-2.44-2.68-4.34-5.94-5.7-9.78-1.36-3.84-2.04-8.16-2.04-12.96 0-4.32.78-8.34 2.34-12.06 1.56-3.72 3.6-6.92 6.12-9.6 2.52-2.68 5.38-4.78 8.58-6.3 3.2-1.52 6.48-2.28 9.84-2.28 2.56 0 4.82.22 6.78.66 1.96.44 3.68 1.06 5.16 1.86s2.78 1.74 3.9 2.82a35.92 35.92 0 0 1 3.12 3.42V88.57l10.68 8.64Zm-27.96 67.92c3.6 0 6.52-.68 8.76-2.04 2.24-1.36 3.98-3.06 5.22-5.1a20.5 20.5 0 0 0 2.58-6.54c.48-2.32.72-4.44.72-6.36v-1.2c0-1.12-.22-2.7-.66-4.74-.44-2.04-1.28-4.06-2.52-6.06s-3-3.7-5.28-5.1c-2.28-1.4-5.22-2.02-8.82-1.86-3.44 0-6.26.74-8.46 2.22-2.2 1.48-3.96 3.26-5.28 5.34-1.32 2.08-2.24 4.2-2.76 6.36-.52 2.16-.78 3.92-.78 5.28 0 1.84.24 3.92.72 6.24.48 2.32 1.36 4.48 2.64 6.48s3.04 3.68 5.28 5.04c2.24 1.36 5.12 2.04 8.64 2.04ZM882.81 97.09c.64.48.96 1.12.96 1.92l-.12 41.04v37.08l-10.56-8.4c-.72-.64-1.08-1.44-1.08-2.4V88.45l10.8 8.64ZM950.36 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14Z" style="fill-rule:nonzero" transform="translate(-452.406 -63.709) scale(1.00797)"/><path d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75Z" style="fill:url(#a);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98Z" style="fill:url(#b);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33Z" style="fill:url(#c);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04Z" style="fill:url(#d);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5Z" style="fill:#9c3;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59Z" style="fill:url(#e);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5Z" style="fill:url(#f);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1Z" style="fill:#ffe113;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75Z" style="fill:#f3e600;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><defs><linearGradient id="a" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)"><stop offset="0" style="stop-color:#62d399;stop-opacity:1"/><stop offset=".51" style="stop-color:#acd842;stop-opacity:1"/><stop offset=".9" style="stop-color:#d7db0a;stop-opacity:1"/><stop offset="1" style="stop-color:#d7db0a;stop-opacity:1"/></linearGradient><linearGradient id="b" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-90.565 123.412 54.953) scale(162.14)"><stop offset="0" style="stop-color:#0ba398;stop-opacity:1"/><stop offset=".5" style="stop-color:#4ca352;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30a;stop-opacity:1"/></linearGradient><linearGradient id="c" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="scale(-68) rotate(88.4 .881 -1.396)"><stop offset="0" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".19" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".54" style="stop-color:#49a459;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30b;stop-opacity:1"/></linearGradient><linearGradient id="d" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-88 87.255 68.431) scale(62.42)"><stop offset="0" style="stop-color:#267880;stop-opacity:1"/><stop offset=".51" style="stop-color:#457a5c;stop-opacity:1"/><stop offset="1" style="stop-color:#717516;stop-opacity:1"/></linearGradient><linearGradient id="e" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-79.1 149.53 -14.065) scale(73.28)"><stop offset="0" style="stop-color:#b0d939;stop-opacity:1"/><stop offset="1" style="stop-color:#eadb04;stop-opacity:1"/></linearGradient><linearGradient id="f" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-67.997 148.705 -15.558) scale(69.8226)"><stop offset="0" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".17" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".48" style="stop-color:#99be32;stop-opacity:1"/><stop offset="1" style="stop-color:#c0c40a;stop-opacity:1"/></linearGradient></defs></svg>',jO=btoa(LO),DO="data:image/svg+xml;charset=utf-8;base64,"+jO,BO=DO,ab=typeof window!==void 0?window.location.search.includes("debugcontext"):!1;var me=(n=>(n.ContextRegistered="ContextRegistered",n.ContextCreationStart="ContextCreationStart",n.ContextCreated="ContextCreated",n.ContextFirstFrameRendered="ContextFirstFrameRendered",n.ContextDestroying="ContextDestroying",n.ContextDestroyed="ContextDestroyed",n.MissingCamera="MissingCamera",n.ContextClearing="ContextClearing",n.ContextCleared="ContextCleared",n))(me||{});class pe{static get Current(){return globalThis["NeedleEngine.Context.Current"]}static set Current(e){globalThis["NeedleEngine.Context.Current"]=e}static get All(){return this.Registered}static register(e){this.Registered.indexOf(e)===-1&&(ab&&console.warn("Registering context"),this.Registered.push(e),this.dispatchCallback("ContextRegistered",e))}static unregister(e){const t=this.Registered.indexOf(e);t!==-1&&(ab&&console.warn("Unregistering context"),this.Registered.splice(t,1))}static registerCallback(e,t){this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t)}static unregisterCallback(e,t){if(!this._callbacks[e])return;const s=this._callbacks[e].indexOf(t);s!==-1&&this._callbacks[e].splice(s,1)}static dispatchCallback(e,t,s){if(!this._callbacks[e])return!0;const o={event:e,context:t};if(s)for(const l in s)o[l]=s[l];const r=new Array;return this._callbacks[e].forEach(l=>{const c=l(o);c instanceof Promise&&r.push(c)}),Promise.all(r)}static addContextCreatedCallback(e){this.registerCallback("ContextCreated",e)}static addContextDestroyedCallback(e){this.registerCallback("ContextDestroyed",e)}}a(pe,"Registered",[]),a(pe,"_callbacks",{});const lb=()=>n=>n;function FO(n){return lb()(n)}function UO(){return!!C("debug")}class ki{constructor(e,t){a(this,"_factory"),a(this,"_cache",[]),a(this,"_maxSize"),a(this,"_index",0),this._factory=e,this._maxSize=t}get(){const e=this._index%this._maxSize;return this._index++,this._cache.length<=e&&(this._cache[e]=this._factory()),this._cache[e]}}let yr=!1;const Qm=new Array;typeof window<"u"&&setTimeout(()=>{if(yr){const n={},e=new URL(window.location.href),t=new URL(e);t.searchParams.append("console","");const s=t.toString().replace(/=$|=(?=&)/g,"");for(const r of Qm){const l=new URL(e);l.searchParams.append(r,""),n[r]=l.toString().replace(/=$|=(?=&)/g,"")}console.log(`\u{1F335} ?help: Debug Options for Needle Engine.
|
|
1
|
+
var RC=Object.defineProperty,Mv=n=>{throw TypeError(n)},TC=(n,e,t)=>e in n?RC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,a=(n,e,t)=>TC(n,typeof e!="symbol"?e+"":e,t),Mm=(n,e,t)=>e.has(n)||Mv("Cannot "+t),ge=(n,e,t)=>(Mm(n,e,"read from private field"),t?t.call(n):e.get(n)),Fs=(n,e,t)=>e.has(n)?Mv("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Us=(n,e,t,s)=>(Mm(n,e,"write to private field"),s?s.call(n,t):e.set(n,t),t),ud=(n,e,t)=>(Mm(n,e,"access private method"),t);import{Vector2 as ie,Vector3 as S,Vector4 as fe,Quaternion as V,PlaneGeometry as zs,WebGLRenderer as gr,PerspectiveCamera as we,OrthographicCamera as pd,Scene as Si,Mesh as q,Texture as je,Uniform$1 as Qi,Color as re,ShaderMaterial as Ns,Box3 as Ci,ShadowMaterial as Rv,Euler as Dt,MeshStandardMaterial as bt,Box3Helper as EC,GridHelper as Rm,Object3D as A,Material as Pe,Matrix3 as Tv,Matrix4 as ne,Layers as po,Ray as mo,MathUtils as Cn,AxesHelper as Pi,MeshBasicMaterial as Me,DoubleSide as Oi,BufferGeometry as Ws,Group as go,CylinderGeometry as Ev,SphereGeometry as md,BoxGeometry as xa,SpriteMaterial as AC,Sprite as IC,Shape as LC,ExtrudeGeometry as jC,Fog as Av,DirectionalLight as Tm,PointLight as Em,EdgesGeometry as DC,LineSegments as Iv,LineBasicMaterial as Lv,Line as Hl,BufferAttribute as _t,Raycaster as gd,Sphere as fd,ArrayCamera as BC,Plane as fr,SkinnedMesh as Pn,InterleavedBufferAttribute as jv,Skeleton as FC,Bone as UC,Source as zC,WebGLCubeRenderTarget as NC,CubeCamera as WC,AnimationClip as fo,FileLoader as Am,TextureLoader as Sa,PropertyBinding as Ca,LinearSRGBColorSpace as On,ShaderChunk as qt,UniformsLib as VC,DataTexture as Im,RGBAFormat as yd,EquirectangularReflectionMapping as kn,SRGBColorSpace as Mn,Clock as $C,NeutralToneMapping as Pa,AgXToneMapping as vd,ACESFilmicToneMapping as bd,NoToneMapping as _d,PCFSoftShadowMap$1 as HC,BasicNodeLibrary as GC,WebGLRenderTarget as Vs,DepthTexture as Dv,NearestFilter as wd,LoopRepeat as qC,LoopOnce as Lm,AnimationMixer as jm,CompressedTexture as XC,FrontSide as yo,Camera as QC,Frustum as Bv,AudioListener as YC,PositionalAudio as KC,AudioLoader as Dm,EventDispatcher as Bm,BackSide as xd,MeshDepthMaterial as ZC,CustomBlending as JC,MaxEquation as eP,AmbientLight as tP,HemisphereLight as iP,AlwaysStencilFunc as sP,GreaterEqualStencilFunc as nP,NotEqualStencilFunc as oP,GreaterStencilFunc as rP,LessEqualStencilFunc as aP,EqualStencilFunc as lP,LessStencilFunc as cP,NeverStencilFunc as Fv,InvertStencilOp as hP,DecrementWrapStencilOp as dP,IncrementWrapStencilOp as uP,DecrementStencilOp as pP,IncrementStencilOp as mP,ReplaceStencilOp as gP,ZeroStencilOp as fP,KeepStencilOp as yP,RawShaderMaterial as Uv,GLSL3 as vP,AlwaysDepth as bP,GreaterEqualDepth as _P,GreaterDepth as wP,LessEqualDepth as xP,LessDepth as SP,NotEqualDepth as CP,EqualDepth as PP,BatchedMesh as zv,MeshPhysicalMaterial as Fm,LinearFilter as Sd,UnsignedByteType as OP,RingGeometry as kP,Line3 as MP,AdditiveBlending as Nv,BoxHelper as RP,SpotLight as TP,DirectionalLightHelper as EP,CameraHelper as AP,LOD as IP,Triangle as LP,NormalBlending as jP,ReinhardToneMapping as Um,LinearToneMapping as zm,HalfFloatType as Nm,VideoTexture as DP,CubeTexture as BP,CompressedCubeTexture as FP,EquirectangularRefractionMapping as UP,VectorKeyframeTrack as zP,QuaternionKeyframeTrack as NP,Audio as WP,ShaderLib as Cd,UniformsUtils as Wv,MirroredRepeatWrapping as Vv,MeshNormalMaterial as VP,AudioContext as $P,PMREMGenerator$1 as HP}from"./three-DuDKwKB8.min.js";import{createLoaders as Wm,getRaycastMesh as $v,LODsManager as Oa,NEEDLE_progressive as Xe,addDracoAndKTX2Loaders as GP,configureLoader as qP,setKTX2TranscoderLocation as XP,setDracoDecoderLocation as QP}from"./gltf-progressive-zQ2CaD2H.min.js";import{GroundedSkybox as ka,Font as YP,TextGeometry as KP,FontLoader as ZP,GLTFLoader as Rn,TransformControlsGizmo as Hv,EXRLoader as Pd,RGBELoader as Vm,Stats as JP,nodeFrame as eO,OrbitControls as Gv,PositionalAudioHelper as tO,HorizontalBlurShader as iO,VerticalBlurShader as sO,GLTFExporter as qv,strToU8 as Xv,zipSync as nO,XRControllerModelFactory as oO,XRHandMeshModel as rO,Line2 as aO,LineGeometry as lO,LineMaterial as cO,KTX2Loader as hO,TransformControls as dO,InteractiveGroup as uO,HTMLMesh as pO,VertexNormalsHelper as mO,OBJLoader as $m,FBXLoader as Qv,mergeVertices as gO}from"./three-examples-BMOhDaYR.min.js";import{fetchProfile as fO,MotionController as yO,$70d766613f57b014$export$2e2bcd8739ae039 as Yv,ByteBuffer as vO,v5 as Kv,md5 as Zv,SIZE_PREFIX_LENGTH as Jv,Builder as Hm,createNoise4D as bO,Matrix4 as Gm,BatchedParticleRenderer as _O,ParticleSystem as wO,RenderMode as Tn,ConstantColor as xO,Vector4 as SO,ConstantValue as CO,TrailParticle as eb,WorkerBase as PO,MeshBVH as OO}from"./vendor-BlSxe9JJ.min.js";import{__webpack_exports__default as Re,__webpack_exports__Text as tb,__webpack_exports__Block as ib,__webpack_exports__update as kO,SimpleStateBehavior as MO,__webpack_exports__Inline as qm,__webpack_exports__FontLibrary as sb,ThreeMeshUI as nb}from"./three-mesh-ui-B3p3gyUz.min.js";import{EffectAttribute as RO}from"./postprocessing-BzY0H7ry.min.js";const Xm=new Map;function Xt(n=(e=>(e=globalThis.location)==null?void 0:e.hostname)()){if(Xm.has(n))return Xm.get(n);const e=/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|localhost/.test(n);return Xm.set(n,e),e===!0}function ob(){return window.location.hostname.includes("glitch.me")}const TO='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 160 187.74"><defs><linearGradient id="a" x1="89.64" y1="184.81" x2="90.48" y2="21.85" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#62d399"/><stop offset=".51" stop-color="#acd842"/><stop offset=".9" stop-color="#d7db0a"/></linearGradient><linearGradient id="b" x1="69.68" y1="178.9" x2="68.08" y2="16.77" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0ba398"/><stop offset=".5" stop-color="#4ca352"/><stop offset="1" stop-color="#76a30a"/></linearGradient><linearGradient id="c" x1="36.6" y1="152.17" x2="34.7" y2="84.19" gradientUnits="userSpaceOnUse"><stop offset=".19" stop-color="#36a382"/><stop offset=".54" stop-color="#49a459"/><stop offset="1" stop-color="#76a30b"/></linearGradient><linearGradient id="d" x1="15.82" y1="153.24" x2="18" y2="90.86" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#267880"/><stop offset=".51" stop-color="#457a5c"/><stop offset="1" stop-color="#717516"/></linearGradient><linearGradient id="e" x1="135.08" y1="135.43" x2="148.93" y2="63.47" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#b0d939"/><stop offset="1" stop-color="#eadb04"/></linearGradient><linearGradient id="f" x1="-4163.25" y1="2285.12" x2="-4160.81" y2="2215.34" gradientTransform="rotate(20 4088.49 13316.712)" gradientUnits="userSpaceOnUse"><stop offset=".17" stop-color="#74af52"/><stop offset=".48" stop-color="#99be32"/><stop offset="1" stop-color="#c0c40a"/></linearGradient><symbol id="g" viewBox="0 0 160 187.74"><path style="fill:url(#a)" d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75z"/><path style="fill:url(#b)" d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98z"/><path style="fill:url(#c)" d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z"/><path style="fill:url(#d)" d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04z"/><path style="fill:#9c3" d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5z"/><path style="fill:url(#e)" d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59z"/><path style="fill:url(#f)" d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z"/><path style="fill:#ffe113" d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1z"/><path style="fill:#f3e600" d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75z"/></symbol></defs><use width="160" height="187.74" xlink:href="#g"/></svg>',EO=btoa(TO),AO="data:image/svg+xml;base64,"+EO,rb=AO,IO=`<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'> <svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" version="1.1" viewBox="0 0 1014 282" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m665.95 132.73v44.88l-10.56-8.4c-0.8-0.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18 0.4-6.06 1.2s-3.54 1.8-4.98 3-2.56 2.5-3.36 3.9-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c0.32 0.24 0.56 0.44 0.72 0.6s0.36 0.32 0.6 0.48c0.96-1.2 2.14-2.28 3.54-3.24s2.92-1.76 4.56-2.4 3.34-1.14 5.1-1.5 3.44-0.54 5.04-0.54c1.44 0 2.92 0.04 4.44 0.12s2.84 0.28 3.96 0.6c4.56 1.12 7.8 3.12 9.72 6s2.88 6.56 2.88 11.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m732.38 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m795.93 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m858.57 97.21c0.64 0.48 0.96 1.16 0.96 2.04v74.88c-0.08 1.04-0.12 2.12-0.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18s-2.06-1.66-2.46-1.98c-1.76 2.48-4.26 4.44-7.5 5.88s-7.02 2.16-11.34 2.16c-3.84 0-7.4-0.7-10.68-2.1s-6.14-3.44-8.58-6.12-4.34-5.94-5.7-9.78-2.04-8.16-2.04-12.96c0-4.32 0.78-8.34 2.34-12.06s3.6-6.92 6.12-9.6 5.38-4.78 8.58-6.3 6.48-2.28 9.84-2.28c2.56 0 4.82 0.22 6.78 0.66s3.68 1.06 5.16 1.86 2.78 1.74 3.9 2.82 2.16 2.22 3.12 3.42v-35.04l10.68 8.64zm-27.96 67.92c3.6 0 6.52-0.68 8.76-2.04s3.98-3.06 5.22-5.1 2.1-4.22 2.58-6.54 0.72-4.44 0.72-6.36v-1.2c0-1.12-0.22-2.7-0.66-4.74s-1.28-4.06-2.52-6.06-3-3.7-5.28-5.1-5.22-2.02-8.82-1.86c-3.44 0-6.26 0.74-8.46 2.22s-3.96 3.26-5.28 5.34-2.24 4.2-2.76 6.36-0.78 3.92-0.78 5.28c0 1.84 0.24 3.92 0.72 6.24s1.36 4.48 2.64 6.48 3.04 3.68 5.28 5.04 5.12 2.04 8.64 2.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m882.81 97.09c0.64 0.48 0.96 1.12 0.96 1.92l-0.12 41.04v37.08l-10.56-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-77.88l10.8 8.64z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m950.36 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.8559 0 0 .7642 45.348 36.475)"> <g transform="translate(2.7114)"> <path d="m3.935 173.02c-0.331 0-0.497-0.402-0.497-1.207v-51.002c0-0.738 0.138-1.107 0.414-1.107h1.781c0.277 0 0.415 0.335 0.415 1.006v5.935c0 0.336 0.027 0.553 0.083 0.654 0.055 0.101 0.151-0.017 0.289-0.352 0.912-1.744 1.754-3.236 2.527-4.477 0.773-1.24 1.554-2.179 2.341-2.816s1.65-0.956 2.588-0.956c1.685 0 3.011 0.922 3.977 2.766 0.967 1.845 1.602 3.84 1.905 5.986 0.056 0.268 0.139 0.369 0.249 0.302s0.221-0.235 0.331-0.503c0.939-1.811 1.802-3.353 2.589-4.628 0.787-1.274 1.581-2.246 2.382-2.917s1.671-1.006 2.61-1.006c2.016 0 3.569 1.392 4.66 4.175 1.09 2.783 1.636 6.421 1.636 10.915v37.925c0 0.871-0.18 1.307-0.539 1.307h-1.739c-0.138 0-0.249-0.1-0.332-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.338-6.321-1.015-8.3-0.676-1.978-1.76-2.967-3.251-2.967-0.884 0-1.726 0.386-2.527 1.157s-1.519 1.727-2.154 2.867-1.201 2.213-1.699 3.219c-0.248 0.469-0.421 0.905-0.517 1.308-0.097 0.402-0.145 0.972-0.145 1.71v37.221c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.166 0-0.29-0.1-0.373-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.332-6.321-0.994-8.3-0.663-1.978-1.754-2.967-3.273-2.967-1.242 0-2.375 0.704-3.396 2.112-1.022 1.409-2.223 3.555-3.604 6.439v39.031c0 0.805-0.18 1.207-0.539 1.207h-1.698z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m53.642 166.28c-1.077 2.549-2.237 4.477-3.479 5.785-1.243 1.307-2.61 1.961-4.101 1.961-2.154 0-3.853-1.324-5.095-3.973-1.243-2.649-1.864-6.187-1.864-10.613 0-3.488 0.4-6.489 1.201-9.004s1.988-4.51 3.562-5.985c1.574-1.476 3.521-2.414 5.841-2.817l3.686-0.704c0.221-0.067 0.394-0.218 0.518-0.453 0.124-0.234 0.187-0.587 0.187-1.056v-2.917c0-3.89-0.504-6.975-1.512-9.255s-2.354-3.42-4.039-3.42c-1.298 0-2.472 0.72-3.521 2.162s-2.002 3.572-2.858 6.388c-0.083 0.268-0.159 0.453-0.228 0.554-0.069 0.1-0.172 0.083-0.311-0.051l-1.698-1.71c-0.083-0.134-0.138-0.285-0.166-0.453-0.027-0.167 0.014-0.452 0.125-0.855 0.856-3.353 2.009-6.052 3.459-8.098 1.449-2.045 3.224-3.068 5.322-3.068 1.74 0 3.211 0.687 4.412 2.062s2.112 3.37 2.734 5.986c0.621 2.615 0.932 5.7 0.932 9.255v35.712c0 0.536-0.035 0.888-0.104 1.056s-0.2 0.251-0.393 0.251h-1.533c-0.166 0-0.29-0.117-0.373-0.352-0.083-0.234-0.124-0.553-0.124-0.955l-0.083-5.231c-0.055-0.939-0.221-1.006-0.497-0.202zm0.456-19.314c0-1.14-0.194-1.643-0.58-1.509l-3.107 0.603c-1.436 0.202-2.686 0.638-3.749 1.308-1.063 0.671-1.953 1.543-2.671 2.616s-1.257 2.33-1.616 3.772-0.538 3.102-0.538 4.98c0 3.152 0.455 5.616 1.367 7.393 0.911 1.778 2.14 2.666 3.686 2.666 0.939 0 1.85-0.419 2.734-1.257s1.671-1.895 2.361-3.169c0.663-1.408 1.181-2.85 1.553-4.326 0.373-1.475 0.56-2.883 0.56-4.225v-8.852z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m79.034 173.02c-0.166 0-0.297-0.117-0.394-0.352-0.096-0.234-0.145-0.553-0.145-0.955v-4.628c0-0.536-0.041-0.838-0.124-0.905s-0.207 0.1-0.373 0.503c-0.276 0.67-0.69 1.593-1.242 2.766-0.553 1.174-1.271 2.23-2.154 3.169-0.884 0.939-1.961 1.408-3.231 1.408-1.74 0-3.314-0.989-4.722-2.967-1.409-1.979-2.534-4.963-3.376-8.953-0.843-3.991-1.264-8.937-1.264-14.838 0-5.701 0.415-10.68 1.243-14.939s1.988-7.595 3.479-10.009c1.492-2.415 3.204-3.622 5.137-3.622 1.436 0 2.616 0.57 3.541 1.71 0.926 1.14 1.719 2.381 2.382 3.722 0.249 0.47 0.414 0.637 0.497 0.503s0.125-0.536 0.125-1.207v-23.841c0-0.805 0.151-1.208 0.455-1.208h1.864c0.276 0 0.414 0.369 0.414 1.107v72.128c0 0.537-0.041 0.905-0.124 1.107-0.083 0.201-0.235 0.301-0.455 0.301h-1.533zm-0.621-42.049c-0.939-2.213-1.885-3.94-2.838-5.181s-2.009-1.861-3.169-1.861c-1.463 0-2.768 0.889-3.914 2.666s-2.044 4.376-2.693 7.796-0.973 7.578-0.973 12.474c0 5.097 0.338 9.272 1.015 12.524 0.676 3.253 1.567 5.651 2.672 7.193 1.104 1.543 2.305 2.314 3.603 2.314 1.188 0 2.258-0.704 3.211-2.113 0.952-1.408 1.705-3.118 2.257-5.13s0.829-3.957 0.829-5.835v-24.847z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m89.514 149.38c0 3.42 0.345 6.606 1.035 9.557 0.691 2.951 1.609 5.315 2.755 7.092s2.437 2.666 3.873 2.666c1.519 0 2.837-0.738 3.956-2.213 1.118-1.476 2.064-3.655 2.837-6.539 0.083-0.336 0.166-0.52 0.249-0.554 0.083-0.033 0.179 0.017 0.29 0.151l1.408 1.912c0.221 0.268 0.235 0.67 0.041 1.207-0.69 2.548-1.47 4.661-2.34 6.337-0.87 1.677-1.857 2.935-2.962 3.773-1.104 0.838-2.319 1.257-3.645 1.257-2.043 0-3.838-1.14-5.385-3.42-1.546-2.28-2.761-5.482-3.645-9.607-0.884-4.124-1.325-8.836-1.325-14.134 0-5.901 0.455-10.931 1.367-15.089 0.911-4.158 2.14-7.377 3.686-9.658 1.547-2.28 3.3-3.42 5.261-3.42 1.988 0 3.714 1.073 5.178 3.219 1.463 2.146 2.595 5.231 3.396 9.255s1.201 8.886 1.201 14.587c0 0.469-0.02 0.939-0.062 1.408-0.041 0.469-0.214 0.704-0.517 0.704h-16.362c-0.083 0-0.152 0.151-0.207 0.453-0.056 0.302-0.083 0.654-0.083 1.056zm13.752-6.237c0.304 0 0.497-0.1 0.58-0.302 0.083-0.201 0.124-0.57 0.124-1.106 0-3.219-0.283-6.187-0.849-8.903s-1.367-4.896-2.402-6.539c-1.036-1.643-2.272-2.464-3.708-2.464-1.629 0-2.996 0.955-4.101 2.867-1.104 1.911-1.94 4.342-2.506 7.293s-0.849 6.002-0.849 9.154h13.711z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m148.54 119.7c0.165 0 0.283 0.117 0.352 0.352s0.076 0.52 0.02 0.855l-6.254 50.902c-0.028 0.47-0.104 0.788-0.228 0.956s-0.297 0.251-0.518 0.251h-1.615c-0.442 0-0.718-0.402-0.829-1.207l-5.26-40.138c-0.111-0.604-0.201-0.905-0.27-0.905s-0.131 0.301-0.186 0.905l-5.012 40.138c-0.028 0.47-0.097 0.788-0.207 0.956-0.111 0.168-0.277 0.251-0.497 0.251h-1.74c-0.442 0-0.718-0.402-0.829-1.207l-6.503-50.801c-0.055-0.403-0.048-0.721 0.021-0.956s0.2-0.352 0.393-0.352h1.823c0.166 0 0.297 0.067 0.393 0.201 0.097 0.134 0.159 0.403 0.187 0.805l5.302 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.219-41.949c0.055-0.268 0.124-0.47 0.207-0.604s0.193-0.201 0.331-0.201h1.533c0.138 0 0.262 0.067 0.373 0.201 0.11 0.134 0.179 0.403 0.207 0.805l5.468 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.053-41.849c0.055-0.335 0.138-0.57 0.249-0.704 0.11-0.134 0.234-0.201 0.373-0.201h1.284z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m156.49 171.51c0 0.604-0.042 1.006-0.125 1.208-0.082 0.201-0.262 0.301-0.538 0.301h-1.533c-0.221 0-0.366-0.083-0.435-0.251s-0.103-0.486-0.103-0.956v-50.902c0-0.805 0.152-1.207 0.456-1.207h1.822c0.304 0 0.456 0.402 0.456 1.207v50.6zm0.165-63.979c0 1.207-0.207 1.811-0.621 1.811h-1.905c-0.221 0-0.366-0.135-0.435-0.403s-0.104-0.67-0.104-1.207v-7.847c0-1.006 0.18-1.509 0.539-1.509h1.988c0.359 0 0.538 0.47 0.538 1.409v7.746z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m168.3 124.83c-0.221 0-0.331 0.269-0.331 0.805v33.801c0 3.42 0.221 5.667 0.663 6.74 0.441 1.073 1.09 1.609 1.946 1.609h3.024c0.138 0 0.242 0.084 0.311 0.252 0.069 0.167 0.103 0.419 0.103 0.754v2.716c0 0.537-0.138 0.906-0.414 1.107-0.248 0.067-0.614 0.134-1.098 0.201-0.483 0.067-0.959 0.118-1.429 0.151-0.469 0.034-0.828 0.05-1.077 0.05-1.712 0-2.934-0.955-3.665-2.867-0.732-1.911-1.098-5.013-1.098-9.305v-35.108c0-0.604-0.124-0.906-0.373-0.906h-3.521c-0.248 0-0.373-0.268-0.373-0.804v-3.521c0-0.537 0.111-0.805 0.332-0.805h3.686c0.166 0 0.263-0.268 0.29-0.805l0.415-16.095c0-0.805 0.124-1.207 0.372-1.207h1.492c0.303 0 0.455 0.436 0.455 1.307v15.995c0 0.537 0.097 0.805 0.29 0.805h5.468c0.221 0 0.331 0.268 0.331 0.805v3.521c0 0.536-0.124 0.804-0.373 0.804h-5.426z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m179.4 173.02c-0.331 0-0.497-0.402-0.497-1.207v-72.329c0-0.738 0.138-1.107 0.414-1.107h1.782c0.276 0 0.414 0.336 0.414 1.006v27.162c0 0.335 0.034 0.536 0.103 0.603s0.159-0.033 0.27-0.302c0.994-1.81 1.898-3.319 2.713-4.526 0.814-1.208 1.629-2.113 2.444-2.717 0.814-0.603 1.691-0.905 2.63-0.905 2.182 0 3.839 1.375 4.971 4.125 1.132 2.749 1.698 6.404 1.698 10.965v37.925c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.165 0-0.29-0.1-0.373-0.301-0.082-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.366-6.321-1.097-8.3-0.732-1.978-1.899-2.967-3.501-2.967-0.883 0-1.705 0.318-2.464 0.956-0.76 0.637-1.526 1.576-2.299 2.816-0.773 1.241-1.643 2.834-2.61 4.779v39.031c0 0.805-0.179 1.207-0.538 1.207h-1.699z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> </g> <g transform="matrix(.80638 0 0 .80638 452.53 65.421)" fill-rule="nonzero"> <path d="m79.32 36.98v150.76l15.68-13.2 6.59-156.31-22.27 18.75z" fill="url(#f)"/> <path d="m79.32 36.98-22.27-18.75 6.59 156.31 15.68 13.2v-150.76z" fill="url(#e)"/> <path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z" fill="url(#d)"/> <path d="m25.19 104.83-25.19-14.59 16.97 53.86 16.85 9.77-8.63-49.04z" fill="url(#c)"/> <path d="M43.86,82.5L18.69,67.98L0,90.24L25.18,104.83L43.86,82.5Z" fill="#9c3"/> <path d="m134.82 78.69-9.97 56.5 15.58-9.04 19.57-62.05-25.18 14.59z" fill="url(#b)"/> <path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z" fill="url(#a)"/> <path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33 25.19-14.59z" fill="#ffe113"/> <path d="M101.59,18.23L79.32,0L57.05,18.23L79.32,36.98L101.59,18.23Z" fill="#f3e600"/> </g> <defs> <linearGradient id="f" x2="1" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)" gradientUnits="userSpaceOnUse"><stop stop-color="#62d399" offset="0"/><stop stop-color="#acd842" offset=".51"/><stop stop-color="#d7db0a" offset=".9"/><stop stop-color="#d7db0a" offset="1"/></linearGradient> <linearGradient id="e" x2="1" gradientTransform="matrix(-1.6,-162.13,162.13,-1.6,69.68,178.9)" gradientUnits="userSpaceOnUse"><stop stop-color="#0ba398" offset="0"/><stop stop-color="#4ca352" offset=".5"/><stop stop-color="#76a30a" offset="1"/></linearGradient> <linearGradient id="d" x2="1" gradientTransform="matrix(-1.9,-67.98,67.98,-1.9,36.6,152.17)" gradientUnits="userSpaceOnUse"><stop stop-color="#36a382" offset="0"/><stop stop-color="#36a382" offset=".19"/><stop stop-color="#49a459" offset=".54"/><stop stop-color="#76a30b" offset="1"/></linearGradient> <linearGradient id="c" x2="1" gradientTransform="matrix(2.18,-62.38,62.38,2.18,15.82,153.24)" gradientUnits="userSpaceOnUse"><stop stop-color="#267880" offset="0"/><stop stop-color="#457a5c" offset=".51"/><stop stop-color="#717516" offset="1"/></linearGradient> <linearGradient id="b" x2="1" gradientTransform="matrix(13.85,-71.96,71.96,13.85,135.08,135.43)" gradientUnits="userSpaceOnUse"><stop stop-color="#b0d939" offset="0"/><stop stop-color="#eadb04" offset="1"/></linearGradient> <linearGradient id="a" x2="1" gradientTransform="matrix(26.159 -64.737 64.737 26.159 107.42 128.14)" gradientUnits="userSpaceOnUse"><stop stop-color="#74af52" offset="0"/><stop stop-color="#74af52" offset=".17"/><stop stop-color="#99be32" offset=".48"/><stop stop-color="#c0c40a" offset="1"/></linearGradient> </defs> </svg>`;btoa(IO);const LO='<svg viewBox="0 0 509 154" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M665.95 132.73v44.88l-10.56-8.4c-.8-.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18.4-6.06 1.2-1.88.8-3.54 1.8-4.98 3-1.44 1.2-2.56 2.5-3.36 3.9-.8 1.4-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-.72-.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c.32.24.56.44.72.6.16.16.36.32.6.48.96-1.2 2.14-2.28 3.54-3.24 1.4-.96 2.92-1.76 4.56-2.4 1.64-.64 3.34-1.14 5.1-1.5 1.76-.36 3.44-.54 5.04-.54 1.44 0 2.92.04 4.44.12 1.52.08 2.84.28 3.96.6 4.56 1.12 7.8 3.12 9.72 6 1.92 2.88 2.88 6.56 2.88 11.04ZM732.38 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM795.93 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM858.57 97.21c.64.48.96 1.16.96 2.04v74.88c-.08 1.04-.12 2.12-.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18-1.24-1-2.06-1.66-2.46-1.98-1.76 2.48-4.26 4.44-7.5 5.88-3.24 1.44-7.02 2.16-11.34 2.16-3.84 0-7.4-.7-10.68-2.1-3.28-1.4-6.14-3.44-8.58-6.12-2.44-2.68-4.34-5.94-5.7-9.78-1.36-3.84-2.04-8.16-2.04-12.96 0-4.32.78-8.34 2.34-12.06 1.56-3.72 3.6-6.92 6.12-9.6 2.52-2.68 5.38-4.78 8.58-6.3 3.2-1.52 6.48-2.28 9.84-2.28 2.56 0 4.82.22 6.78.66 1.96.44 3.68 1.06 5.16 1.86s2.78 1.74 3.9 2.82a35.92 35.92 0 0 1 3.12 3.42V88.57l10.68 8.64Zm-27.96 67.92c3.6 0 6.52-.68 8.76-2.04 2.24-1.36 3.98-3.06 5.22-5.1a20.5 20.5 0 0 0 2.58-6.54c.48-2.32.72-4.44.72-6.36v-1.2c0-1.12-.22-2.7-.66-4.74-.44-2.04-1.28-4.06-2.52-6.06s-3-3.7-5.28-5.1c-2.28-1.4-5.22-2.02-8.82-1.86-3.44 0-6.26.74-8.46 2.22-2.2 1.48-3.96 3.26-5.28 5.34-1.32 2.08-2.24 4.2-2.76 6.36-.52 2.16-.78 3.92-.78 5.28 0 1.84.24 3.92.72 6.24.48 2.32 1.36 4.48 2.64 6.48s3.04 3.68 5.28 5.04c2.24 1.36 5.12 2.04 8.64 2.04ZM882.81 97.09c.64.48.96 1.12.96 1.92l-.12 41.04v37.08l-10.56-8.4c-.72-.64-1.08-1.44-1.08-2.4V88.45l10.8 8.64ZM950.36 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14Z" style="fill-rule:nonzero" transform="translate(-452.406 -63.709) scale(1.00797)"/><path d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75Z" style="fill:url(#a);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98Z" style="fill:url(#b);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33Z" style="fill:url(#c);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04Z" style="fill:url(#d);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5Z" style="fill:#9c3;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59Z" style="fill:url(#e);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5Z" style="fill:url(#f);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1Z" style="fill:#ffe113;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75Z" style="fill:#f3e600;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><defs><linearGradient id="a" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)"><stop offset="0" style="stop-color:#62d399;stop-opacity:1"/><stop offset=".51" style="stop-color:#acd842;stop-opacity:1"/><stop offset=".9" style="stop-color:#d7db0a;stop-opacity:1"/><stop offset="1" style="stop-color:#d7db0a;stop-opacity:1"/></linearGradient><linearGradient id="b" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-90.565 123.412 54.953) scale(162.14)"><stop offset="0" style="stop-color:#0ba398;stop-opacity:1"/><stop offset=".5" style="stop-color:#4ca352;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30a;stop-opacity:1"/></linearGradient><linearGradient id="c" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="scale(-68) rotate(88.4 .881 -1.396)"><stop offset="0" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".19" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".54" style="stop-color:#49a459;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30b;stop-opacity:1"/></linearGradient><linearGradient id="d" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-88 87.255 68.431) scale(62.42)"><stop offset="0" style="stop-color:#267880;stop-opacity:1"/><stop offset=".51" style="stop-color:#457a5c;stop-opacity:1"/><stop offset="1" style="stop-color:#717516;stop-opacity:1"/></linearGradient><linearGradient id="e" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-79.1 149.53 -14.065) scale(73.28)"><stop offset="0" style="stop-color:#b0d939;stop-opacity:1"/><stop offset="1" style="stop-color:#eadb04;stop-opacity:1"/></linearGradient><linearGradient id="f" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-67.997 148.705 -15.558) scale(69.8226)"><stop offset="0" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".17" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".48" style="stop-color:#99be32;stop-opacity:1"/><stop offset="1" style="stop-color:#c0c40a;stop-opacity:1"/></linearGradient></defs></svg>',jO=btoa(LO),DO="data:image/svg+xml;charset=utf-8;base64,"+jO,BO=DO,ab=typeof window!==void 0?window.location.search.includes("debugcontext"):!1;var me=(n=>(n.ContextRegistered="ContextRegistered",n.ContextCreationStart="ContextCreationStart",n.ContextCreated="ContextCreated",n.ContextFirstFrameRendered="ContextFirstFrameRendered",n.ContextDestroying="ContextDestroying",n.ContextDestroyed="ContextDestroyed",n.MissingCamera="MissingCamera",n.ContextClearing="ContextClearing",n.ContextCleared="ContextCleared",n))(me||{});class pe{static get Current(){return globalThis["NeedleEngine.Context.Current"]}static set Current(e){globalThis["NeedleEngine.Context.Current"]=e}static get All(){return this.Registered}static register(e){this.Registered.indexOf(e)===-1&&(ab&&console.warn("Registering context"),this.Registered.push(e),this.dispatchCallback("ContextRegistered",e))}static unregister(e){const t=this.Registered.indexOf(e);t!==-1&&(ab&&console.warn("Unregistering context"),this.Registered.splice(t,1))}static registerCallback(e,t){this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t)}static unregisterCallback(e,t){if(!this._callbacks[e])return;const s=this._callbacks[e].indexOf(t);s!==-1&&this._callbacks[e].splice(s,1)}static dispatchCallback(e,t,s){if(!this._callbacks[e])return!0;const o={event:e,context:t};if(s)for(const l in s)o[l]=s[l];const r=new Array;return this._callbacks[e].forEach(l=>{const c=l(o);c instanceof Promise&&r.push(c)}),Promise.all(r)}static addContextCreatedCallback(e){this.registerCallback("ContextCreated",e)}static addContextDestroyedCallback(e){this.registerCallback("ContextDestroyed",e)}}a(pe,"Registered",[]),a(pe,"_callbacks",{});const lb=()=>n=>n;function FO(n){return lb()(n)}function UO(){return!!C("debug")}class ki{constructor(e,t){a(this,"_factory"),a(this,"_cache",[]),a(this,"_maxSize"),a(this,"_index",0),this._factory=e,this._maxSize=t}get(){const e=this._index%this._maxSize;return this._index++,this._cache.length<=e&&(this._cache[e]=this._factory()),this._cache[e]}}let yr=!1;const Qm=new Array;typeof window<"u"&&setTimeout(()=>{if(yr){const n={},e=new URL(window.location.href),t=new URL(e);t.searchParams.append("console","");const s=t.toString().replace(/=$|=(?=&)/g,"");for(const r of Qm){const l=new URL(e);l.searchParams.append(r,""),n[r]=l.toString().replace(/=$|=(?=&)/g,"")}console.log(`\u{1F335} ?help: Debug Options for Needle Engine.
|
|
2
2
|
Append any of these parameters to the URL to enable specific debug options.
|
|
3
3
|
Example: ${s} will show an onscreen console window.`);const o=yr===!0?"":` (containing "${yr}")`;console.group("Available URL parameters:"+o);for(const r of Object.keys(n).sort())typeof yr=="string"&&!r.toLowerCase().includes(yr.toLowerCase())||(console.groupCollapsed(r),console.log("Reload with this flag enabled:"),console.log(n[r]),console.groupEnd());console.groupEnd()}},100);function Gl(){var n;return new URLSearchParams((n=globalThis.location)==null?void 0:n.search)}function C(n){yr&&!Qm.includes(n)&&Qm.push(n);const e=Gl();if(e.has(n)){const t=e.get(n);if(t){const s=Number(t);return isNaN(s)?t:s}else return!0}return!1}yr=C("help");function zO(n,e){const t=Gl();t.has(n)?t.set(n,e):t.append(n,e),document.location.search=t.toString()}function ql(n,e,t=!0){const s=Gl();s.has(n)?e===null?s.delete(n):s.set(n,e):e!==null&&s.append(n,e),t?cb(n,s):Km(n,s)}function Ym(n,e,t){n.has(e)?n.set(e,t.toString()):n.append(e,t.toString())}function cb(n,e,t){window.history.pushState(t,n,"?"+e.toString())}function Km(n,e,t){window.history.replaceState(t,n,"?"+e.toString())}function NO(n){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s=t.length,o=0;o<n;o++)e+=t.charAt(Math.floor(Math.random()*s));return e}function WO(n,e){return Math.floor(Math.random()*(e-n+1))+n}const hb=["smol","tiny","giant","interesting","smart","bright","dull","extreme","beautiful","pretty","dark","epic","salty","silly","funny","lame","lazy","loud","lucky","mad","mean","mighty","mysterious","nasty","odd","old","powerful","quiet","rapid","scary","shiny","shy","silly","smooth","sour","spicy","stupid","sweet","tasty","terrible","ugly","unusual","vast","wet","wild","witty","wrong","zany","zealous","zippy","zombie","zorro"],db=["cat","dog","mouse","pig","cow","horse","sheep","chicken","duck","goat","panda","tiger","lion","elephant","monkey","bird","fish","snake","frog","turtle","hamster","penguin","kangaroo","whale","dolphin","crocodile","snail","ant","bee","beetle","butterfly","dragon","eagle","fish","giraffe","lizard","panda","penguin","rabbit","snake","spider","tiger","zebra"];function ub(){const n=hb[Math.floor(Math.random()*hb.length)],e=db[Math.floor(Math.random()*db.length)];return n+"_"+e}function pb(n){return n=n.replace(/[^a-z0-9áéíóúñü \.,_-]/gim,""),n.trim()}function Ma(n,e,t=!0,s=!1){var o;if(e==null)return null;if(e.userData&&e.userData.guid===n||e.guid==n)return e;if(s&&(o=e.userData)!=null&&o.components){for(const r of e.userData.components)if(r.guid===n)return r}if(t){if(e.scenes)for(const r in e.scenes){const l=e.scenes[r],c=Ma(n,l,t,s);if(c)return c}if(e.children)for(const r in e.children){const l=e.children[r],c=Ma(n,l,t,s);if(c)return c}}}function Xl(n,e){if(n!=null&&typeof n=="object"){let t;Array.isArray(n)?t=[]:(t=Object.create(n),Object.assign(t,n));for(const s of Object.keys(n)){const o=n[s];e&&!e(n,s,o)?t[s]=o:o?.clone!==void 0&&typeof o.clone=="function"?t[s]=o.clone():t[s]=Xl(o,e)}return t}return n}function $s(n){return new Promise((e,t)=>{setTimeout(e,n)})}function Ql(n,e){if(n<=0)return Promise.resolve();if(e||(e=pe.Current),!e)return Promise.reject("No context");const t=e.time.frameCount+n;return new Promise((s,o)=>{if(!e)return o("No context");const r=()=>{e.time.frameCount>=t&&(e.pre_update_callbacks.splice(e.pre_update_callbacks.indexOf(r),1),s())};e.pre_update_callbacks.push(r)})}const Od=C("debugresolveurl"),mb="rel:";function VO(n,e){return vo(n,e)}function vo(n,e){if(e===void 0)return Od&&console.warn("getPath: uri is undefined, returning uri",e),e;if(e.startsWith("./"))return e;if(e.startsWith("http"))return Od&&console.warn("getPath: uri is absolute, returning uri",e),e;if(n===void 0)return Od&&console.warn("getPath: source is undefined, returning uri",e),e;e.startsWith(mb)&&(e=e.substring(4));const t=n.lastIndexOf("/");if(t>=0){const s=n.substring(0,t+1);for(;s.endsWith("/")&&e.startsWith("/");)e=e.substring(1);const o=s+e;return Od&&console.log("source:",n,`changed uri
|
|
4
4
|
from`,e,`
|
|
@@ -142,7 +142,7 @@ Open this page to get the console: `+e.toString())}const n=Q.isMobileDevice()||Q
|
|
|
142
142
|
#__vconsole .vc-mask {
|
|
143
143
|
overflow: hidden;
|
|
144
144
|
}
|
|
145
|
-
`,Ki?.prepend(s),n===!0&&ig()<=0&&qb(),console.log("\u{1F335} Debug console has loaded")}},e.onerror=()=>{console.warn("\u{1F335} Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),nc=!1,oi=null},e.src="https://cdn.jsdelivr.net/npm/vconsole@3.9.1/dist/vconsole.min.js",document.body.appendChild(e)}function Wk(){if(!globalThis.VConsole)return;const n=new VConsole.VConsolePlugin("needle-console","\u{1F335} Inspect glTF"),e=()=>document.querySelector("#__vc_plug_"+n._id+" iframe");return n.on("renderTab",function(t){const s=globalThis["needle:codegen_files"];if(!s||s.length===0)return;let o=globalThis["needle:codegen_files"][0];const r=o.indexOf("?");r>-1&&(o=o.substring(0,r));const l=location.protocol+"//"+location.host+location.pathname+"/"+o,c=encodeURIComponent(l);n.fullUrl="https://viewer.needle.tools?inspect&file="+c;var h='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';t(h)}),n.on("show",function(){const t=e();t&&t.src!==n.fullUrl&&(t.src=n.fullUrl)}),n.on("hide",function(){const t=e();t&&(t.src="")}),n.on("addTopBar",function(t){var s=new Array;s.push({name:"Open in new window \u2197",onClick:function(o){window.open(n.fullUrl,"_blank"),oi?.hide()}}),s.push({name:"Reload",onClick:function(o){const r=e();r&&(r.src=n.fullUrl)}}),s.push({name:"Fullscreen",onClick:function(o){const r=e();r.requestFullscreen?r.requestFullscreen():r.webkitRequestFullscreen instanceof Function&&r.webkitRequestFullscreen()}}),t(s)}),n}function Vk(){return document.querySelector("#__vconsole .vc-switch")||null}function $k(){return document.querySelector("#__vconsole")||null}const Kb=C("debugdefines");_o('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";'),_o('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";'),_o('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";'),_o('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";'),_o('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.7.3
|
|
145
|
+
`,Ki?.prepend(s),n===!0&&ig()<=0&&qb(),console.log("\u{1F335} Debug console has loaded")}},e.onerror=()=>{console.warn("\u{1F335} Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),nc=!1,oi=null},e.src="https://cdn.jsdelivr.net/npm/vconsole@3.9.1/dist/vconsole.min.js",document.body.appendChild(e)}function Wk(){if(!globalThis.VConsole)return;const n=new VConsole.VConsolePlugin("needle-console","\u{1F335} Inspect glTF"),e=()=>document.querySelector("#__vc_plug_"+n._id+" iframe");return n.on("renderTab",function(t){const s=globalThis["needle:codegen_files"];if(!s||s.length===0)return;let o=globalThis["needle:codegen_files"][0];const r=o.indexOf("?");r>-1&&(o=o.substring(0,r));const l=location.protocol+"//"+location.host+location.pathname+"/"+o,c=encodeURIComponent(l);n.fullUrl="https://viewer.needle.tools?inspect&file="+c;var h='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';t(h)}),n.on("show",function(){const t=e();t&&t.src!==n.fullUrl&&(t.src=n.fullUrl)}),n.on("hide",function(){const t=e();t&&(t.src="")}),n.on("addTopBar",function(t){var s=new Array;s.push({name:"Open in new window \u2197",onClick:function(o){window.open(n.fullUrl,"_blank"),oi?.hide()}}),s.push({name:"Reload",onClick:function(o){const r=e();r&&(r.src=n.fullUrl)}}),s.push({name:"Fullscreen",onClick:function(o){const r=e();r.requestFullscreen?r.requestFullscreen():r.webkitRequestFullscreen instanceof Function&&r.webkitRequestFullscreen()}}),t(s)}),n}function Vk(){return document.querySelector("#__vconsole .vc-switch")||null}function $k(){return document.querySelector("#__vconsole")||null}const Kb=C("debugdefines");_o('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";'),_o('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";'),_o('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";'),_o('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";'),_o('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.7.3";'),_o('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),_o('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Aug 06 2025 12:10:59 GMT+0000 (Coordinated Universal Time)";'),_o('globalThis["__NEEDLE_PUBLIC_KEY__"] = "'+NEEDLE_PUBLIC_KEY+'";');const _s="4.7.3",Dd="undefined",wg="Wed Aug 06 2025 12:10:59 GMT+0000 (Coordinated Universal Time)";Kb&&console.log(`Engine version: ${_s} (generator: ${Dd})
|
|
146
146
|
Project built at ${wg}`);const Ea=NEEDLE_PUBLIC_KEY,En="needle_isActiveInHierarchy",wr="builtin_components",rc="needle_editor_guid";function _o(n){try{(0,eval)(n)}catch(e){Kb&&console.error(e)}}let Zb,Jb=null;function ws(){return Zb}function xg(n){if(n==null){console.warn("Oh no: someone tried registering a non-existend gltf-loader. When you see this log it might mean that needle-engine is being imported multiple times. Please check your project setup.");return}Jb!==n&&(Jb=n,Zb=new n)}const Ri=Symbol("shadowDomOwner"),Hk=C("debugpatch");function Bd(n,e,t,s){const o=Hk===e;if(!t&&!s)return;const r=e+"___needle";qk(n,e,t,s);const l=Object.getOwnPropertyDescriptor(n,e),c=n[e];o&&console.log("Patch",n.constructor.name,e,l,c),l?(o&&console.log("Apply patch with existing descriptor",n.constructor.name,e,l),typeof l.value=="function"&&(n[e]=t_(l.value,n,e))):(o&&console.log("Create patch with new property",n.constructor.name,e,l),Object.defineProperty(n,e,{set:function(h){if(typeof h=="function")this[r]=t_(h,n,e);else{const d=this[r];i_(n,e,this,d,h),this[r]=h,s_(n,e,this,d,h)}},get:function(){const h=this[r];return typeof h=="function"&&h[r]?h[r]:h}}))}function Gk(n,e,t){const s=Cg(n,e);if(s)for(let o=s.length-1;o>=0;o--){const r=s[o];r.prefix===t&&(r.prefix=null),r.postfix===t&&(r.postfix=null),!r.prefix&&!r.postfix&&s.splice(o,1)}}const e_=Symbol("Needle:Patches:WrappedFunction");function t_(n,e,t){if(n[e_])return n;const s=function(...o){i_(e,t,this,...o);const r=n.apply(this,o);return s_(e,t,this,r,...o),r};return s[e_]=!0,s}const Fd="Needle:Patches";function Sg(){return globalThis[Fd]||(globalThis[Fd]=new WeakMap),globalThis[Fd]}function Cg(n,e){const t=Sg().get(n);return t?t.get(e):null}function qk(n,e,t,s){let o=Sg().get(n);o||(o=new Map,Sg().set(n,o));let r=o.get(e);r||(r=[],o.set(e,r)),r.push({prefix:t,postfix:s})}function i_(n,e,t,...s){var o;if(!t)return;const r=Cg(n,e);if(r)for(const l of r)(o=l.prefix)==null||o.call(t,...s)}function s_(n,e,t,s,...o){var r;if(!t)return;const l=Cg(n,e);if(l)for(const c of l)(r=c.postfix)==null||r.call(t,s,...o)}const Aa=[];function Ud(n){Aa.indexOf(n)===-1&&Aa.push(n)}function Xk(n){const e=Aa.indexOf(n);e!==-1&&Aa.splice(e,1)}const Ia=[];function Pg(n){Ia.indexOf(n)===-1&&Ia.push(n)}function Qk(n){const e=Ia.indexOf(n);e!==-1&&Ia.splice(e,1)}function n_(n){globalThis.dispatchEvent(new CustomEvent("needle-xrsession-start",{detail:n}));for(let e=0;e<Aa.length;e++)Aa[e](n)}function o_(n){globalThis.dispatchEvent(new CustomEvent("needle-xrsession-end",{detail:n}));for(let e=0;e<Ia.length;e++)Ia[e](n)}const ct=C("debuginput");var zd=(n=>(n.Mouse="mouse",n.Touch="touch",n.Controller="controller",n.Hand="hand",n))(zd||{}),Be=(n=>(n.PointerDown="pointerdown",n.PointerUp="pointerup",n.PointerMove="pointermove",n.KeyDown="keydown",n.KeyUp="keyup",n.KeyPressed="keypress",n))(Be||{});class An extends PointerEvent{constructor(e,t,s){super(e,s),a(this,"clientZ"),a(this,"deviceIndex"),a(this,"origin"),a(this,"source"),a(this,"mode"),a(this,"_ray"),a(this,"space"),a(this,"isClick",!1),a(this,"isDoubleClick",!1),a(this,"_used",!1),a(this,"_pointerid"),a(this,"_pointerType"),a(this,"_type"),a(this,"metadata",{}),a(this,"intersections",new Array),a(this,"_immediatePropagationStopped",!1),a(this,"_propagationStopped",!1),this.clientZ=s.clientZ,this._pointerid=s.pointerId,this._pointerType=s.pointerType,this._type=e,this.deviceIndex=s.deviceIndex,this.origin=s.origin,this.source=t,this.mode=s.mode,this._ray=s.ray,this.space=s.device}get isSpatial(){return this.mode!="screen"}get ray(){return this._ray||(this._ray=new mo(this.space.worldPosition.clone(),this.space.worldForward.clone())),this._ray}set ray(e){this._ray=e}get hasRay(){return this._ray!==void 0}get used(){return this._used}use(){this._used=!0}get pointerId(){return this._pointerid}get pointerType(){return this._pointerType}get type(){return this._type}get immediatePropagationStopped(){return this._immediatePropagationStopped}get propagationStopped(){return this._immediatePropagationStopped||this._propagationStopped}stopImmediatePropagation(){var e;this._immediatePropagationStopped=!0,super.stopImmediatePropagation(),(e=this.source)==null||e.stopImmediatePropagation()}stopPropagation(){var e;this._propagationStopped=!0,super.stopPropagation(),(e=this.source)==null||e.stopPropagation(),ct&&console.warn("Stop propagation...",this.pointerId,this.pointerType)}}class ac extends KeyboardEvent{constructor(e,t,s){super(e,s),a(this,"source"),this.source=t}stopImmediatePropagation(){var e;super.stopImmediatePropagation(),(e=this.source)==null||e.stopImmediatePropagation()}}class Yk{constructor(e){a(this,"key"),a(this,"keyType"),a(this,"source"),this.key=e.key,this.keyType=e.type,this.source=e}}var ri=(n=>(n[n.Early=-100]="Early",n[n.Default=0]="Default",n[n.Late=100]="Late",n))(ri||{});class r_{constructor(e){a(this,"_eventListeners",{}),a(this,"_doubleClickTimeThreshold",.2),a(this,"_longPressTimeThreshold",1),a(this,"_setCursorTypes",[]),a(this,"context"),a(this,"_pointerDown",[!1]),a(this,"_pointerUp",[!1]),a(this,"_pointerClick",[!1]),a(this,"_pointerDoubleClick",[!1]),a(this,"_pointerPressed",[!1]),a(this,"_pointerPositions",[new ie]),a(this,"_pointerPositionsLastFrame",[new ie]),a(this,"_pointerPositionsDelta",[new ie]),a(this,"_pointerPositionsRC",[new ie]),a(this,"_pointerPositionDown",[new S]),a(this,"_pointerDownTime",[]),a(this,"_pointerUpTime",[]),a(this,"_pointerUpTimestamp",[]),a(this,"_pointerIds",[]),a(this,"_pointerTypes",[""]),a(this,"_mouseWheelChanged",[!1]),a(this,"_mouseWheelDeltaY",[0]),a(this,"_pointerEvent",[]),a(this,"_pointerEventsPressed",[]),a(this,"_pointerSpace",[]),a(this,"_pressedStack",new Map),a(this,"_htmlEventSource"),a(this,"onLostFocus",()=>{for(const t in this.keysPressed)this.keysPressed[t].pressed=!1}),a(this,"_receivedPointerMoveEventsThisFrame",new Array),a(this,"onEndOfFrame",()=>{this._receivedPointerMoveEventsThisFrame.length=0;for(let t=0;t<this._pointerUp.length;t++)this._pointerUp[t]=!1;for(let t=0;t<this._pointerDown.length;t++)this._pointerDown[t]=!1;for(let t=0;t<this._pointerClick.length;t++)this._pointerClick[t]=!1;for(let t=0;t<this._pointerDoubleClick.length;t++)this._pointerDoubleClick[t]=!1;for(const t of this._pointerPositionsDelta)t.set(0,0);for(let t=0;t<this._mouseWheelChanged.length;t++)this._mouseWheelChanged[t]=!1;for(let t=0;t<this._mouseWheelDeltaY.length;t++)this._mouseWheelDeltaY[t]=0}),a(this,"onContextMenu",t=>{this.canReceiveInput(t)!==!1&&t instanceof PointerEvent&&t.pointerType}),a(this,"keysPressed",{}),a(this,"onKeyDown",t=>{if(ct&&console.log(`key down ${t.code}, ${this.context.application.hasFocus}`,t),!this.context.application.hasFocus)return;const s=this.keysPressed[t.code];if(s&&s.pressed)return;this.keysPressed[t.code]={pressed:!0,frame:this.context.time.frameCount+1,startFrame:this.context.time.frameCount+1,key:t.key,code:t.code};const o=new ac("keydown",t,t);this.onDispatchEvent(o)}),a(this,"onKeyPressed",t=>{if(!this.context.application.hasFocus)return;const s=this.keysPressed[t.code];if(!s)return;s.pressed=!0,s.frame=this.context.time.frameCount+1;const o=new ac("keypress",t,t);this.onDispatchEvent(o)}),a(this,"onKeyUp",t=>{if(!this.context.application.hasFocus)return;const s=this.keysPressed[t.code];if(!s)return;s.pressed=!1,s.frame=this.context.time.frameCount+1;const o=new ac("keyup",t,t);this.onDispatchEvent(o)}),a(this,"onWheelWindow",t=>{document.pointerLockElement&&this.onMouseWheel(t)}),a(this,"onMouseWheel",t=>{if(this.canReceiveInput(t)===!1)return;this._mouseWheelDeltaY.length<=0&&this._mouseWheelDeltaY.push(0),this._mouseWheelChanged.length<=0&&this._mouseWheelChanged.push(!1),this._mouseWheelChanged[0]=!0;const s=this._mouseWheelDeltaY[0];this._mouseWheelDeltaY[0]=s+t.deltaY}),a(this,"onPointerDown",t=>{if(this.context.isInAR||this.canReceiveInput(t)===!1)return;t.target instanceof HTMLElement&&t.target.setPointerCapture(t.pointerId);const s=this.getPointerId(t);ct&&De(`pointer down #${s}, identifier:${t.pointerId}`);const o=this.getAndUpdateSpatialObjectForScreenPosition(s,t.clientX,t.clientY),r=new An("pointerdown",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:s,button:t.button,clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,buttonName:this.getButtonName(t),device:o,pressure:t.pressure});this.onDown(r)}),a(this,"onPointerMove",t=>{if(this.context.isInAR||this._receivedPointerMoveEventsThisFrame.includes(t.pointerId))return;this._receivedPointerMoveEventsThisFrame.push(t.pointerId);let s=t.button;t.pointerType==="mouse"&&(s=this.getFirstPressedButtonForPointer(0)??0);const o=this.getPointerId(t,s);s===-1&&(s=o);const r=this.getAndUpdateSpatialObjectForScreenPosition(o,t.clientX,t.clientY),l=new An("pointermove",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:o,button:s,clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,buttonName:this.getButtonName(t),device:r,pressure:t.pressure});this.onMove(l)}),a(this,"onPointerCancel",t=>{this.context.isInAR||(ct&&console.log("Pointer cancel",t),this.onPointerUp(t))}),a(this,"onPointerUp",t=>{if(this.context.isInAR)return;t.target instanceof HTMLElement&&t.target.releasePointerCapture(t.pointerId);const s=this.getPointerId(t),o=new An("pointerup",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:s,button:t.button,clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,buttonName:this.getButtonName(t),device:this.getAndUpdateSpatialObjectForScreenPosition(s,t.clientX,t.clientY),pressure:t.pressure});this.onUp(o),this._pointerIds[s]=-1,ct&&console.log("ID="+s,"PointerId="+t.pointerId,"ALL:",[...this._pointerIds])}),a(this,"onTouchStart",t=>{if(this.context.isInAR)for(let s=0;s<t.changedTouches.length;s++){const o=t.changedTouches[s],r=this.getPointerIndex(o.identifier),l=this.getAndUpdateSpatialObjectForScreenPosition(r,o.clientX,o.clientY),c=new An("pointerdown",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:r,button:0,clientX:o.clientX,clientY:o.clientY,pointerType:"touch",buttonName:"unknown",device:l,pressure:o.force});this.onDown(c)}}),a(this,"onTouchMove",t=>{if(this.context.isInAR)for(let s=0;s<t.changedTouches.length;s++){const o=t.changedTouches[s],r=this.getPointerIndex(o.identifier),l=this.getAndUpdateSpatialObjectForScreenPosition(r,o.clientX,o.clientY),c=new An("pointermove",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:r,button:0,clientX:o.clientX,clientY:o.clientY,pointerType:"touch",buttonName:"unknown",device:l,pressure:o.force});this.onMove(c)}}),a(this,"onTouchEnd",t=>{if(this.context.isInAR)for(let s=0;s<t.changedTouches.length;s++){const o=t.changedTouches[s],r=this.getPointerIndex(o.identifier),l=new An("pointerup",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:r,button:0,clientX:o.clientX,clientY:o.clientY,pointerType:"touch",buttonName:"unknown",device:this.getAndUpdateSpatialObjectForScreenPosition(r,o.clientX,o.clientY),pressure:o.force});this.onUp(l),this._pointerIds[r]=-1}}),a(this,"tempNearPlaneVector",new S),a(this,"tempFarPlaneVector",new S),a(this,"tempLookMatrix",new ne),this.context=e,this.context.post_render_callbacks.push(this.onEndOfFrame)}addEventListener(e,t,s){if(this._eventListeners[e]||(this._eventListeners[e]=[]),!t||typeof t!="function"){console.error("Invalid call to addEventListener: callback is required and must be a function!");return}s?s={...s}:s={};let o=0;s?.queue!=null&&(o=s.queue);const r=this._eventListeners[e],l=r.find(c=>c.priority===o);l?l.listeners.push({callback:t,options:s}):(r.push({priority:o,listeners:[{callback:t,options:s}]}),r.sort((c,h)=>c.priority-h.priority))}removeEventListener(e,t,s){if(!this._eventListeners[e]||!t)return;const o=this._eventListeners[e];if(s?.queue!=null){const r=o.find(c=>c.priority===s.queue);if(!r)return;const l=r.listeners.findIndex(c=>c.callback===t);l>=0&&r.listeners.splice(l,1)}else for(const r of o){const l=r.listeners.findIndex(c=>c.callback===t);l>=0&&r.listeners.splice(l,1)}}dispatchEvent(e){var t,s,o,r;let l=!1;if(e instanceof ac){const c=this._eventListeners[e.type];if(c)for(const h of c)for(let d=0;d<h.listeners.length;d++){const u=h.listeners[d];if((s=(t=u.options)==null?void 0:t.signal)!=null&&s.aborted){h.listeners.splice(d,1),d--;continue}u.options.once&&(h.listeners.splice(d,1),d--),u.callback(e)}}if(e instanceof An){const c=this._eventListeners[e.type];if(c)for(const h of c){if(l)break;for(let d=0;d<h.listeners.length;d++){const u=h.listeners[d];if((r=(o=u.options)==null?void 0:o.signal)!=null&&r.aborted){h.listeners.splice(d,1),d--;continue}if(e.immediatePropagationStopped){l=!0,ct&&console.log("immediatePropagationStopped",e.type);break}else e.propagationStopped&&(l=!0,ct&&console.log("propagationStopped",e.type));u.options.once&&(h.listeners.splice(d,1),d--),u.callback(e)}}}}get mousePosition(){return this._pointerPositions[0]}get mousePositionRC(){return this._pointerPositionsRC[0]}get mouseDown(){return this._pointerDown[0]}get mouseUp(){return this._pointerUp[0]}get mouseClick(){return this._pointerClick[0]}get mouseDoubleClick(){return this._pointerDoubleClick[0]}get mousePressed(){return this._pointerPressed[0]}get mouseWheelChanged(){return this.getMouseWheelChanged(0)}get click(){return this._pointerClick[0]}get doubleClick(){return this._pointerDoubleClick[0]}getGamepad(e=0){return typeof navigator<"u"&&"getGamepads"in navigator&&navigator.getGamepads()[e]||null}setCursorPointer(){this.setCursor("pointer")}setCursorNormal(){this.unsetCursor("pointer")}setCursor(e){this._setCursorTypes.push(e),this._setCursorTypes.length>10&&this._setCursorTypes.shift(),this.updateCursor()}unsetCursor(e){for(let t=this._setCursorTypes.length-1;t>=0;t--)if(this._setCursorTypes[t]===e){this._setCursorTypes.splice(t,1),this.updateCursor();break}}updateCursor(){var e;((e=this._setCursorTypes)==null?void 0:e.length)==0?this.context.domElement.style.cursor="default":this.context.domElement.style.cursor=this._setCursorTypes[this._setCursorTypes.length-1]}getIsPointerIdInUse(e){for(const t of this._pointerEventsPressed)if(t.pointerId===e&&t.used)return!0;return!1}getPointerPressedCount(){let e=0;for(let t=0;t<this._pointerPressed.length;t++)this._pointerPressed[t]&&e++;return e}getPointerPosition(e){return e>=this._pointerPositions.length?null:this._pointerPositions[e]}getPointerPositionLastFrame(e){return e>=this._pointerPositionsLastFrame.length?null:this._pointerPositionsLastFrame[e]}getPointerPositionDelta(e){return e>=this._pointerPositionsDelta.length?null:this._pointerPositionsDelta[e]}getPointerPositionRC(e){return e>=this._pointerPositionsRC.length?null:this._pointerPositionsRC[e]}getPointerDown(e){return e>=this._pointerDown.length?!1:this._pointerDown[e]}getPointerUp(e){return e>=this._pointerUp.length?!1:this._pointerUp[e]}getPointerPressed(e){return e>=this._pointerPressed.length?!1:this._pointerPressed[e]}getPointerClicked(e){return e>=this._pointerClick.length?!1:this._pointerClick[e]}getPointerDoubleClicked(e){return e>=this._pointerDoubleClick.length?!1:this._pointerDoubleClick[e]}getPointerDownTime(e){return e>=this._pointerDownTime.length?-1:this._pointerDownTime[e]}getPointerUpTime(e){return e>=this._pointerUpTime.length?-1:this._pointerUpTime[e]}getPointerLongPress(e){return e>=this._pointerDownTime.length?!1:this.getPointerPressed(e)&&this.context.time.time-this._pointerDownTime[e]>this._longPressTimeThreshold}getIsMouse(e){return e<0||e>=this._pointerTypes.length?!1:this._pointerTypes[e]==="mouse"}getIsTouch(e){return e<0||e>=this._pointerTypes.length?!1:this._pointerTypes[e]==="touch"}getTouchesPressedCount(){let e=0;for(let t=0;t<this._pointerPressed.length;t++)this._pointerPressed[t]&&this.getIsTouch(t)&&e++;return e}getMouseWheelChanged(e=0){return e>=this._mouseWheelChanged.length?!1:this._mouseWheelChanged[e]}getMouseWheelDeltaY(e=0){return e>=this._mouseWheelDeltaY.length?0:this._mouseWheelDeltaY[e]}getPointerEvent(e){if(!(e>=this._pointerEvent.length))return this._pointerEvent[e]??void 0}*foreachPointerId(e){for(let t=0;t<this._pointerTypes.length;t++)if(this._pointerIsActive(t)){if(e!==void 0){const s=this._pointerTypes[t];if(Array.isArray(e)){let o=!1;for(const r of e)if(s===r){o=!0;break}if(!o)continue}else if(e!==s)continue}yield t}}*foreachTouchId(){for(let e=0;e<this._pointerTypes.length;e++)this._pointerTypes[e]==="touch"&&this._pointerIsActive[e]&&(yield e)}_pointerIsActive(e){return e<0?!1:this._pointerPressed[e]||this._pointerDown[e]||this._pointerUp[e]}onDownButton(e,t){let s=this._pressedStack.get(e);s||(s=[],this._pressedStack.set(e,s)),s.push(t)}onReleaseButton(e,t){const s=this._pressedStack.get(e);if(!s)return;const o=s.indexOf(t);o>=0&&s.splice(o,1)}getFirstPressedButtonForPointer(e){const t=this._pressedStack.get(e);if(t)return t[0]}getLatestPressedButtonForPointer(e){const t=this._pressedStack.get(e);if(t)return t[t.length-1]}getKeyDown(e){if(e!==void 0)return this.isKeyDown(e);for(const t in this.keysPressed){const s=this.keysPressed[t];if(s.startFrame===this.context.time.frameCount)return s.key}return null}getKeyPressed(e){if(e!==void 0)return this.isKeyPressed(e);for(const t in this.keysPressed){const s=this.keysPressed[t];if(s.pressed)return s.key}return null}getKeyUp(e){if(e!==void 0)return this.isKeyUp(e);for(const t in this.keysPressed){const s=this.keysPressed[t];return s.pressed===!1&&s.frame===this.context.time.frameCount}return null}isKeyDown(e){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const t=this.getCodeForCommonKeyName(e);if(t!==null){for(const o of t)if(this.isKeyDown(o))return!0;return!1}const s=this.keysPressed[e];return s?s.startFrame===this.context.time.frameCount&&s.pressed:!1}isKeyUp(e){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const t=this.getCodeForCommonKeyName(e);if(t!==null){for(const o of t)if(this.isKeyUp(o))return!0;return!1}const s=this.keysPressed[e];return s?s.frame===this.context.time.frameCount&&s.pressed===!1:!1}isKeyPressed(e){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const t=this.getCodeForCommonKeyName(e);if(t!==null){for(const o of t)if(this.isKeyPressed(o))return!0;return!1}const s=this.keysPressed[e];return s&&s.pressed||!1}getCodeForCommonKeyName(e){if(e.length===1){if(e>="0"&&e<="9")return["Digit"+e];if(e>="a"&&e<="z")return["Key"+e.toUpperCase()];if(e==" ")return["Space"]}switch(e){case"shift":case"Shift":return["ShiftLeft","ShiftRight"];case"control":case"Control":return["ControlLeft","ControlRight"];case"alt":case"Alt":return["AltLeft","AltRight"]}return null}createInputEvent(e){switch(e.type){case"pointerdown":ct&&De("Create Pointer down"),this.onDownButton(e.deviceIndex,e.button),this.onDown(e);break;case"pointermove":ct&&De("Create Pointer move"),this.onMove(e);break;case"pointerup":ct&&De("Create Pointer up"),this.onUp(e),this.onReleaseButton(e.deviceIndex,e.button);break}}convertScreenspaceToRaycastSpace(e){return e.x=(e.x-this.context.domX)/this.context.domWidth*2-1,e.y=-((e.y-this.context.domY)/this.context.domHeight)*2+1,e}bindEvents(){this.unbindEvents(),this._htmlEventSource=this.context.renderer.domElement,window.addEventListener("contextmenu",this.onContextMenu),this._htmlEventSource.addEventListener("pointerdown",this.onPointerDown,{passive:!0}),window.addEventListener("pointermove",this.onPointerMove,{passive:!0,capture:!0}),window.addEventListener("pointerup",this.onPointerUp,{passive:!0}),window.addEventListener("pointercancel",this.onPointerCancel,{passive:!0}),window.addEventListener("touchstart",this.onTouchStart,{passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{passive:!0}),this._htmlEventSource.addEventListener("wheel",this.onMouseWheel,{passive:!0}),window.addEventListener("wheel",this.onWheelWindow,{passive:!0}),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keypress",this.onKeyPressed,!1),window.addEventListener("keyup",this.onKeyUp,!1),window.addEventListener("blur",this.onLostFocus)}unbindEvents(){var e,t;for(const s in this._eventListeners)this._eventListeners[s].length=0;window.removeEventListener("contextmenu",this.onContextMenu),(e=this._htmlEventSource)==null||e.removeEventListener("pointerdown",this.onPointerDown),window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerCancel),window.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),(t=this._htmlEventSource)==null||t.removeEventListener("wheel",this.onMouseWheel,!1),window.removeEventListener("wheel",this.onWheelWindow,!1),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keypress",this.onKeyPressed,!1),window.removeEventListener("keyup",this.onKeyUp,!1),window.removeEventListener("blur",this.onLostFocus)}dispose(){const e=this.context.post_render_callbacks.indexOf(this.onEndOfFrame);e>=0&&this.context.post_render_callbacks.splice(e,1),this.unbindEvents()}canReceiveInput(e){var t;return e.target===((t=this.context.renderer)==null?void 0:t.domElement)||e.target===this.context.domElement||this.context.isInAR||this.context.isInAR&&e.target===document.body&&Q.isMozillaXR()?!0:(ct&&console.warn("CanReceiveInput:False for",e.target),!1)}getPointerId(e,t){return e.pointerType==="mouse"?0+(t??e.button):this.getPointerIndex(e.pointerId)}getButtonName(e){const t=e.button;if(e.pointerType==="mouse")switch(t){case 0:return"left";case 1:return"middle";case 2:return"right"}return"unknown"}getAndUpdateSpatialObjectForScreenPosition(e,t,s){let o=this._pointerSpace[e];o||(o=new A,this._pointerSpace[e]=o),this._pointerSpace[e]=o;const r=this.context.mainCamera;if(r){const l=this.tempNearPlaneVector.set(t,s,-1);this.convertScreenspaceToRaycastSpace(l);const c=this.tempFarPlaneVector.set(l.x,l.y,1);l.unproject(r),c.unproject(r);const h=r.worldUp||X(0,1,0).applyQuaternion(Se(r));this.tempLookMatrix.lookAt(c,l,h),o.position.set(l.x,l.y,l.z),o.quaternion.setFromRotationMatrix(this.tempLookMatrix)}return o}isInRect(e){if(this.context.isInXR)return!0;const t=this.context.domElement.getBoundingClientRect(),s=e.clientX,o=e.clientY,r=s>=t.x&&s<=t.right&&o>=t.y&&o<=t.bottom;return ct&&!r&&console.log("Not in rect",t,s,o),r}onDown(e){const t=e.pointerId;if(this.getPointerPressed(t)&&console.warn(`Received pointerDown for pointerId that is already pressed: ${t}`,ct?e:""),ct&&console.log(e.pointerType,"DOWN",t),!!this.isInRect(e)){for(this.setPointerState(t,this._pointerPressed,!0),this.setPointerState(t,this._pointerDown,!0),this.setPointerStateT(t,this._pointerEvent,e.source);t>=this._pointerTypes.length;)this._pointerTypes.push(e.pointerType);for(this._pointerTypes[t]=e.pointerType;t>=this._pointerPositionDown.length;)this._pointerPositionDown.push(new S);for(this._pointerPositionDown[t].set(e.clientX,e.clientY,e.clientZ??0);t>=this._pointerPositions.length;)this._pointerPositions.push(new ie);this._pointerPositions[t].set(e.clientX,e.clientY),t>=this._pointerDownTime.length&&this._pointerDownTime.push(0),this._pointerDownTime[t]=this.context.time.realtimeSinceStartup,this.updatePointerPosition(e),this._pointerEventsPressed.push(e),this.onDispatchEvent(e)}}onMove(e){const t=e.pointerId,s=this.getPointerPressed(t);s===!1&&!this.isInRect(e)||e.pointerType==="touch"&&!s||(this.updatePointerPosition(e),this.setPointerStateT(t,this._pointerEvent,e.source),this.onDispatchEvent(e))}onUp(e){const t=e.pointerId;if(!this.getPointerPressed(t)){ct&&console.log(e.pointerType,"UP",t,"was not down");return}ct&&console.log(e.pointerType,"UP",t),this.setPointerState(t,this._pointerPressed,!1),this.setPointerStateT(t,this._pointerEvent,e.source),this.setPointerState(t,this._pointerUp,!0),this.updatePointerPosition(e);for(let c=this._pointerEventsPressed.length-1;c>=0;c--)if(this._pointerEventsPressed[c].pointerId===t){this._pointerEventsPressed.splice(c,1);break}if(!this._pointerPositionDown[t]){ct&&be("Received pointer up event without matching down event for button: "+t),console.warn("Received pointer up event without matching down event for button: "+t);return}const s=this._pointerUpTime[t],o=this._pointerDownTime[t],r=this.context.time.realtimeSinceStartup,l=r-o;if(t>=this._pointerUpTime.length&&this._pointerUpTime.push(-99),this._pointerUpTime[t]=r,l<1){let c=e.clientX-this._pointerPositionDown[t].x,h=e.clientY-this._pointerPositionDown[t].y,d=0;if(e.isSpatial&&e.clientZ!=null&&(d=e.clientZ-this._pointerPositionDown[t].z,c*=200,h*=200,d*=200),Math.abs(c)<5&&Math.abs(h)<5&&Math.abs(d)<5){this.setPointerState(t,this._pointerClick,!0),e.isClick=!0;const u=r-s;ct&&console.log("CLICK",t,c,h,d,u),u<this._doubleClickTimeThreshold&&u>0&&(this.setPointerState(t,this._pointerDoubleClick,!0),e.isDoubleClick=!0)}}this.onDispatchEvent(e)}updatePointerPosition(e){const t=e.pointerId;for(;t>=this._pointerPositions.length;)this._pointerPositions.push(new ie);for(;t>=this._pointerPositionsLastFrame.length;)this._pointerPositionsLastFrame.push(new ie);for(;t>=this._pointerPositionsDelta.length;)this._pointerPositionsDelta.push(new ie);const s=this._pointerPositionsLastFrame[t];s.copy(this._pointerPositions[t]);const o=this._pointerPositionsDelta[t];let r=e.clientX-s.x,l=e.clientY-s.y;if(e.source instanceof MouseEvent||e.source instanceof TouchEvent){const u=e.source;r===0&&u.movementX!==0&&(r=u.movementX||0),l===0&&u.movementY!==0&&(l=u.movementY||0)}o.x+=r,o.y+=l,this._pointerPositions[t].x=e.clientX,this._pointerPositions[t].y=e.clientY;const c=e.clientX,h=e.clientY;for(;t>=this._pointerPositionsRC.length;)this._pointerPositionsRC.push(new ie);const d=this._pointerPositionsRC[t];d.set(c,h),this.convertScreenspaceToRaycastSpace(d)}getPointerIndex(e){let t=-1;for(let s=0;s<this._pointerIds.length;s++){if(this._pointerIds[s]===e)return s;t===-1&&this._pointerIds[s]===-1&&(t=s)}return t!==-1?(this._pointerIds[t]=e,t):(ct&&console.log("PUSH pointerId:",e),this._pointerIds.push(e),this._pointerIds.length-1)}setPointerState(e,t,s){t[e]=s}setPointerStateT(e,t,s){return t[e]=s,s}onDispatchEvent(e){const t=J.Current;try{J.Current=this.context,this.dispatchEvent(e)}finally{J.Current=t}}}const La=new ne().makeRotationY(Math.PI),Zi=new V().setFromAxisAngle(new S(0,1,0),Math.PI),Kk=C("debugwebxr");class Zk{constructor(){if(a(this,"priority",-1e5),a(this,"gameObject"),this.gameObject=new A,this.gameObject.name="Implicit XR Rig",Kk){const e=$g(16733661);e.position.y+=.5,this.gameObject.add(e)}}isXRRig(){return!0}get isActive(){return this.gameObject.visible}}const In=C("debugwebxr"),Nd=C("debugcustomgesture"),Jk="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",eM="generic-trigger",tM=new V().setFromEuler(new Dt(Cn.degToRad(0),Cn.degToRad(-90),Cn.degToRad(-90))),iM=new S(.04,-.04,0);class Og{constructor(e,t,s){a(this,"xr"),a(this,"inputSource"),a(this,"index",0),a(this,"emitEvents",!0),a(this,"_connected",!0),a(this,"_isTracking",!1),a(this,"__gamepad"),a(this,"__hand"),a(this,"__side"),a(this,"_hitTestSource"),a(this,"_hasSelectEvent",!1),a(this,"_isMxInk",!1),a(this,"_isMetaQuestTouchController",!1),a(this,"_handJointPoses",new Map),a(this,"_gripMatrix",new ne),a(this,"_gripPosition",new S),a(this,"_gripQuaternion",new V),a(this,"_linearVelocity",new S),a(this,"_rayPositionRaw",new S),a(this,"_rayRotationRaw",new V),a(this,"_rayMatrix",new ne),a(this,"_rayPosition",new S),a(this,"_rayQuaternion",new V),a(this,"_gripWorldPosition",new S),a(this,"_gripWorldQuaternion",new V),a(this,"_rayWorldPosition",new S),a(this,"_rayWorldQuaternion",new V),a(this,"_pinchPosition",new S),a(this,"_ray"),a(this,"_hand_wristDotUp"),a(this,"_object"),a(this,"_gripSpaceObject"),a(this,"_raySpaceObject"),a(this,"model",null),a(this,"_debugAxesHelper",new Pi(.15)),a(this,"_debugGripAxesHelper",new Pi(.07)),a(this,"_debugRayAxesHelper",new Pi(.07)),a(this,"_hitTestSourcePromise",null),a(this,"onPointerHits",o=>{}),a(this,"_needleGamepadButtons",{}),a(this,"_buttonMap",new Map),a(this,"_motioncontroller"),a(this,"_layout"),a(this,"getMotionController"),a(this,"emitPointerDownEvent",!0),a(this,"emitPointerUpEvent",!0),a(this,"emitPointerMoveEvent",!0),a(this,"pointerMoveDistanceThreshold",.03),a(this,"pointerMoveAngleThreshold",.05),a(this,"_selectButtonIndex"),a(this,"_squeezeButtonIndex"),a(this,"onSelectStart",o=>{var r,l,c,h;if(!this.emitPointerDownEvent||this.inputSource!==o.inputSource)return;this.onUpdateFrame(o.frame),this._hasSelectEvent=!0;const d=(r=this._layout)==null?void 0:r.selectComponentId,u=(h=(c=(l=this._layout)==null?void 0:l.components[d])==null?void 0:c.gamepadIndices)==null?void 0:h.button;u!==void 0&&(this._selectButtonIndex=u),!Nd&&(In&&G.DrawDirection(this.rayWorldPosition,X(0,.01,1).applyQuaternion(this.rayWorldQuaternion),16711680,10),this.emitPointerEvent(Be.PointerDown,this._selectButtonIndex||0,"xr-standard-trigger",!0,o))}),a(this,"onSelectEnd",o=>{this.emitPointerUpEvent&&(Nd||this.inputSource===o.inputSource&&this.emitPointerEvent(Be.PointerUp,this._selectButtonIndex||0,"xr-standard-trigger",!0,o))}),a(this,"onSequeezeStart",o=>{var r,l,c;this.emitPointerDownEvent&&this.inputSource===o.inputSource&&(this._squeezeButtonIndex=(c=(l=(r=this._layout)==null?void 0:r.components["xr-standard-squeeze"])==null?void 0:l.gamepadIndices)==null?void 0:c.button,this._squeezeButtonIndex!==void 0&&(In&&G.DrawDirection(this.rayWorldPosition,X(0,.01,1).applyQuaternion(this.rayWorldQuaternion),255,10),this.emitPointerEvent(Be.PointerDown,this._squeezeButtonIndex||0,"xr-standard-squeeze",!0,o)))}),a(this,"onSequeezeEnd",o=>{this.emitPointerUpEvent&&this.inputSource===o.inputSource&&this._squeezeButtonIndex!==void 0&&this.emitPointerEvent(Be.PointerUp,this._squeezeButtonIndex||0,"xr-standard-squeeze",!0,o)}),a(this,"states",{}),a(this,"_didMoveLastFrame",!1),a(this,"_lastPointerMovePosition",new S),a(this,"_lastPointerMoveQuaternion",new V),a(this,"pointerInit"),this.xr=e,this.inputSource=t,this.index=s,this._object=new A,this._object.name=`NeedleXRController_${s}`,In&&(this._object.add(this._debugAxesHelper),this._gripSpaceObject=new A,this._raySpaceObject=new A,this._gripSpaceObject.name=`NeedleXRController_${s}_gripSpace`,this._raySpaceObject.name=`NeedleXRController_${s}_raySpace`,this._gripSpaceObject.add(this._debugGripAxesHelper),this._raySpaceObject.add(this._debugRayAxesHelper),this.xr.context.scene.add(this._gripSpaceObject),this.xr.context.scene.add(this._raySpaceObject)),this.xr.context.scene.add(this._object),this._ray=new mo,this.pointerInit={origin:this,pointerType:this.hand?"hand":"controller",deviceIndex:this.index,pointerId:-1,mode:this.inputSource.targetRayMode,ray:this._ray,device:this._object,buttonName:"none"},this.initialize(),this.subscribeEvents()}get context(){return this.xr.context}get connected(){return this._connected}get isTracking(){return this._isTracking}get gamepad(){return this.__gamepad??(this.__gamepad=this.inputSource.gamepad)}get isHand(){return this.hand!=null}get hand(){return this.__hand??(this.__hand=this.inputSource.hand)}get handObject(){return this.context.renderer.xr.getHand(this.index)}get profiles(){return this.inputSource.profiles}get layout(){return this._layout}get targetRayMode(){return this.inputSource.targetRayMode}get targetRaySpace(){return this.inputSource.targetRaySpace}get gripSpace(){return this.inputSource.gripSpace}get side(){return this.__side??(this.__side=this.inputSource.handedness)}get isRight(){return this.side==="right"}get isLeft(){return this.side==="left"}get isStylus(){return this._isMxInk}getHitTestSource(){return this._hitTestSource||this._requestHitTestSource(),this._hitTestSource}get hasHitTestSource(){return this._hitTestSource}cancelHitTestSource(){this._hitTestSource&&(this._hitTestSource.cancel(),this._hitTestSource=void 0)}get hasSelectEvent(){return this._hasSelectEvent}getHitTest(){return this.xr.getHitTest(this)}getHandJointPose(e,t){var s;if(t=t||this.xr.frame,!this.hand||!(t!=null&&t.getJointPose)||!this.xr.referenceSpace)return null;let o=(s=this._handJointPoses)==null?void 0:s.get(e);return o||(o=t.getJointPose(e,this.xr.referenceSpace),o&&this._handJointPoses.set(e,o),o)}get gripPosition(){return X(this._gripPosition)}get gripQuaternion(){return vs(this._gripQuaternion)}get gripMatrix(){return this._gripMatrix}get gripLinearVelocity(){return X(this._linearVelocity).applyQuaternion(Zi)}get rayPosition(){return X(this._rayPosition)}get rayQuaternion(){return vs(this._rayQuaternion)}get gripWorldPosition(){return X(this._gripWorldPosition)}get gripWorldQuaternion(){return vs(this._gripWorldQuaternion)}get rayWorldPosition(){return X(this._rayWorldPosition)}updateRayWorldPosition(){var e;const t=(e=this.xr.context.mainCamera)==null?void 0:e.parent;this._rayWorldPosition.copy(this._rayPositionRaw),t&&this._rayWorldPosition.applyMatrix4(t.matrixWorld)}get rayWorldQuaternion(){return vs(this._rayWorldQuaternion)}get pinchPosition(){return X(this._pinchPosition)}updateRayWorldQuaternion(){var e;const t=(e=this.xr.context.mainCamera)==null?void 0:e.parent,s=t?Se(t):void 0;this._rayWorldQuaternion.copy(this._rayRotationRaw).multiply(Zi),s&&this._rayWorldQuaternion.premultiply(s)}get ray(){return this._ray.origin.copy(this.rayWorldPosition),this._ray.direction.copy(X(0,0,1).applyQuaternion(this.rayWorldQuaternion)),this._ray}get handWristDotUp(){var e;if(this._hand_wristDotUp!==void 0)return this._hand_wristDotUp;const t=(e=this.handObject)==null?void 0:e.joints.wrist;if(t){const s=X(0,1,0).applyQuaternion(t.quaternion),o=X(0,1,0).dot(s);return this._hand_wristDotUp=o}}get isHandUpsideDown(){return this.handWristDotUp!==void 0?this.handWristDotUp<-.7:!1}get isTeleportGesture(){var e;return this.isHandUpsideDown&&((e=this.getGesture("pinch"))==null?void 0:e.isDown)}get object(){return this._object}async getModelUrl(){var e;return(e=this.getMotionController)==null?void 0:e.then(t=>t?.assetUrl||null)}_requestHitTestSource(){var e;return this._hitTestSourcePromise?this._hitTestSourcePromise:this.xr.mode==="immersive-ar"&&this.inputSource.targetRayMode==="tracked-pointer"&&this.xr.session.requestHitTestSourceForTransientInput?this._hitTestSourcePromise=((e=this.xr.session.requestHitTestSourceForTransientInput({profile:this.inputSource.profiles[0],offsetRay:new XRRay}))==null?void 0:e.then(t=>(this._hitTestSourcePromise=null,this.connected?this._hitTestSource=t:(t.cancel(),null))))??null:null}onUpdate(e){this.onUpdateFrame(e),this.updateInputEvents(),this.onUpdateMove()}onRenderDebug(){var e;G.DrawSphere(this.rayWorldPosition,.003),G.DrawDirection(this.rayWorldPosition,X(0,0,10).applyQuaternion(this.rayWorldQuaternion));const t=(this.inputSource.gripSpace?this.gripWorldPosition:this.object.worldPosition).sub(this.object.worldForward.multiplyScalar(.1)),s=this.inputSource.profiles.join(`
|
|
147
147
|
`);let o=`Controller[${this.index}] (${this.inputSource.targetRayMode}, ${this.side})
|
|
148
148
|
C:${this.connected?"x":"-"} T:${this.isTracking?"x":"-"} Hand:${this.inputSource.hand?"x":"-"} Pen: ${this._isMxInk?"x":"-"}`;if(this.inputSource.hand&&(o+=`
|
|
@@ -211,7 +211,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
|
|
|
211
211
|
irradiance += 0.;
|
|
212
212
|
#else
|
|
213
213
|
irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
|
|
214
|
-
#endif`),VC.lightmap.lightmapScaleOffset={value:new fe(1,1,0,0)};const Sf=C("debugprogressive"),uu=new Ci,pu=new fd;class mR{constructor(e){a(this,"context"),a(this,"_lodsManager"),a(this,"_settings",{}),this.context=e}get manager(){return this._lodsManager}get skinnedMeshAutoUpdateBoundsInterval(){var e;return((e=this._lodsManager)==null?void 0:e.skinnedMeshAutoUpdateBoundsInterval)||this._settings.skinnedMeshAutoUpdateBoundsInterval||0}set skinnedMeshAutoUpdateBoundsInterval(e){this._settings.skinnedMeshAutoUpdateBoundsInterval=e,this.applySettings()}get targetTriangleDensity(){var e;return((e=this._lodsManager)==null?void 0:e.targetTriangleDensity)||this._settings.targetTriangleDensity||2e5}set targetTriangleDensity(e){this._settings.targetTriangleDensity=e,this.applySettings()}applySettings(){if(this._lodsManager)for(const e in this._settings)this._lodsManager[e]=this._settings[e]}setRenderer(e){var t;(t=this._lodsManager)==null||t.disable(),Oa.removePlugin(this),Oa.addPlugin(this),Oa.debugDrawLine=G.DrawLine,this._lodsManager=Oa.get(e),this.applySettings(),this._lodsManager.enable()}disable(){var e;(e=this._lodsManager)==null||e.disable(),Oa.removePlugin(this)}onAfterUpdatedLOD(e,t,s,o,r){Sf&&this.onRenderDebug(s,o,r)}onRenderDebug(e,t,s){var o,r,l;if(!t.geometry||!Xe.hasLODLevelAvailable(t.geometry)&&!Xe.hasLODLevelAvailable(t.material))return;const c=Oa.getObjectLODState(t);if(!c)return;let h=s.mesh_lod;const d=s.mesh_lod!=c.lastLodLevel_Mesh||s.texture_lod!=c.lastLodLevel_Texture;if(Sf&&t.geometry.boundingSphere){const u=t.geometry.boundingSphere;pu.copy(u),pu.applyMatrix4(t.matrixWorld);const p=pu.center,g=pu.radius,f=["#76c43e","#bcc43e","#c4ac3e","#c4673e","#ff3e3e"];if(d)G.DrawWireSphere(p,g,f[h],.1);else{const y=((o=t.geometry.index)==null?void 0:o.count)??0,v=(r=Xe.getMeshLODExtension(t.geometry))==null?void 0:r.lods;h=v?Math.min(v?.length-1,h):0;let b="";if(v&&c.lastScreenCoverage>0)for(let x=0;x<v.length;x++){const k=v[x].density,M=x==v.length-1;b+=k.toFixed(0)+">"+(k/c.lastScreenCoverage).toFixed(0)+(M?"":",")}const _=v?(l=v[h])==null?void 0:l.density:-1;let w="LOD "+s.mesh_lod+`
|
|
214
|
+
#endif`),VC.lightmap.lightmapScaleOffset={value:new fe(1,1,0,0)};const Sf=C("debugprogressive"),uu=new Ci,pu=new fd;class mR{constructor(e){a(this,"context"),a(this,"_lodsManager"),a(this,"_settings",{}),this.context=e}get manager(){return this._lodsManager}get skinnedMeshAutoUpdateBoundsInterval(){var e;return((e=this._lodsManager)==null?void 0:e.skinnedMeshAutoUpdateBoundsInterval)||this._settings.skinnedMeshAutoUpdateBoundsInterval||0}set skinnedMeshAutoUpdateBoundsInterval(e){this._settings.skinnedMeshAutoUpdateBoundsInterval=e,this.applySettings()}get targetTriangleDensity(){var e;return((e=this._lodsManager)==null?void 0:e.targetTriangleDensity)||this._settings.targetTriangleDensity||2e5}set targetTriangleDensity(e){this._settings.targetTriangleDensity=e,this.applySettings()}applySettings(){if(this._lodsManager)for(const e in this._settings)this._lodsManager[e]=this._settings[e]}setRenderer(e){var t;(t=this._lodsManager)==null||t.disable(),Oa.removePlugin(this),Oa.addPlugin(this),Oa.debugDrawLine=G.DrawLine,this._lodsManager=Oa.get(e,{engine:"needle-engine"}),this.applySettings(),this._lodsManager.enable()}disable(){var e;(e=this._lodsManager)==null||e.disable(),Oa.removePlugin(this)}onAfterUpdatedLOD(e,t,s,o,r){Sf&&this.onRenderDebug(s,o,r)}onRenderDebug(e,t,s){var o,r,l;if(!t.geometry||!Xe.hasLODLevelAvailable(t.geometry)&&!Xe.hasLODLevelAvailable(t.material))return;const c=Oa.getObjectLODState(t);if(!c)return;let h=s.mesh_lod;const d=s.mesh_lod!=c.lastLodLevel_Mesh||s.texture_lod!=c.lastLodLevel_Texture;if(Sf&&t.geometry.boundingSphere){const u=t.geometry.boundingSphere;pu.copy(u),pu.applyMatrix4(t.matrixWorld);const p=pu.center,g=pu.radius,f=["#76c43e","#bcc43e","#c4ac3e","#c4673e","#ff3e3e"];if(d)G.DrawWireSphere(p,g,f[h],.1);else{const y=((o=t.geometry.index)==null?void 0:o.count)??0,v=(r=Xe.getMeshLODExtension(t.geometry))==null?void 0:r.lods;h=v?Math.min(v?.length-1,h):0;let b="";if(v&&c.lastScreenCoverage>0)for(let x=0;x<v.length;x++){const k=v[x].density,M=x==v.length-1;b+=k.toFixed(0)+">"+(k/c.lastScreenCoverage).toFixed(0)+(M?"":",")}const _=v?(l=v[h])==null?void 0:l.density:-1;let w="LOD "+s.mesh_lod+`
|
|
215
215
|
TEX `+s.texture_lod;if(Sf=="density"&&(w+=`
|
|
216
216
|
`+y+` tris
|
|
217
217
|
`+(_/c.lastScreenCoverage).toFixed(0)+` dens
|
|
@@ -925,7 +925,7 @@ Exit Time: `+u,l.hasExitTime)}this.transitionTo(l.destinationState,l.duration,l.
|
|
|
925
925
|
// Uncomment to visualize blur amount
|
|
926
926
|
// gl_FragColor = vec4(blurAmount, 0.0, 0.0, 1.0);
|
|
927
927
|
}
|
|
928
|
-
`;var hT=Object.defineProperty,zf=(n,e,t,s)=>{for(var o=void 0,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=l(e,t,o)||o);return o&&hT(e,t,o),o};class Br extends j{constructor(){super(...arguments),a(this,"constraintActive",!0),a(this,"locked",!1),a(this,"sources",[])}}zf([m()],Br.prototype,"constraintActive"),zf([m()],Br.prototype,"locked"),zf([m(A)],Br.prototype,"sources");let Fr=class{constructor(){a(this,"bb",null),a(this,"bb_pos",0)}__init(n,e){return this.bb_pos=n,this.bb=e,this}x(){return this.bb.readFloat32(this.bb_pos)}y(){return this.bb.readFloat32(this.bb_pos+4)}z(){return this.bb.readFloat32(this.bb_pos+8)}static sizeOf(){return 12}static createVec3(n,e,t,s){return n.prep(4,12),n.writeFloat32(s),n.writeFloat32(t),n.writeFloat32(e),n.offset()}};class wx{constructor(){a(this,"bb",null),a(this,"bb_pos",0)}__init(e,t){return this.bb_pos=e,this.bb=t,this}position(e){return(e||new Fr).__init(this.bb_pos,this.bb)}rotation(e){return(e||new Fr).__init(this.bb_pos+12,this.bb)}scale(e){return(e||new Fr).__init(this.bb_pos+24,this.bb)}static sizeOf(){return 36}static createTransform(e,t,s,o,r,l,c,h,d,u){return e.prep(4,36),e.prep(4,12),e.writeFloat32(u),e.writeFloat32(d),e.writeFloat32(h),e.prep(4,12),e.writeFloat32(c),e.writeFloat32(l),e.writeFloat32(r),e.prep(4,12),e.writeFloat32(o),e.writeFloat32(s),e.writeFloat32(t),e.offset()}}class ho{constructor(){a(this,"bb",null),a(this,"bb_pos",0)}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSyncedTransformModel(e,t){return(t||new ho).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSyncedTransformModel(e,t){return e.setPosition(e.position()+Jv),(t||new ho).__init(e.readInt32(e.position())+e.position(),e)}guid(e){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}fast(){const e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}transform(e){const t=this.bb.__offset(this.bb_pos,8);return t?(e||new wx).__init(this.bb_pos+t,this.bb):null}dontSave(){const e=this.bb.__offset(this.bb_pos,10);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startSyncedTransformModel(e){e.startObject(4)}static addGuid(e,t){e.addFieldOffset(0,t,0)}static addFast(e,t){e.addFieldInt8(1,+t,0)}static addTransform(e,t){e.addFieldStruct(2,t,0)}static addDontSave(e,t){e.addFieldInt8(3,+t,0)}static endSyncedTransformModel(e){return e.endObject()}static finishSyncedTransformModelBuffer(e,t){e.finish(t)}static finishSizePrefixedSyncedTransformModelBuffer(e,t){e.finish(t,void 0,!0)}}var L;(n=>{(e=>{e.MAYBEMODULE=null;const t=[];function s(){return e.MODULE?Promise.resolve(e.MODULE):new Promise(r=>{t.push(r)})}e.ready=s;async function o(){if(e.MODULE)return e.MODULE;const r=await import("./rapier-CyWhltHY.min.js");return e.MODULE=r,e.MAYBEMODULE=r,t.forEach(l=>l(r)),t.length=0,r}e.load=o})(n.RAPIER_PHYSICS||(n.RAPIER_PHYSICS={})),(e=>{e.MAYBEMODULE=null;const t=[];function s(){return e.MODULE?Promise.resolve(e.MODULE):new Promise(r=>{t.push(r)})}e.ready=s;async function o(){if(e.MODULE)return e.MODULE;const r=await import("./postprocessing-TkXiVrjY.min.js").then(l=>l.index);return e.MODULE=r,e.MAYBEMODULE=r,t.forEach(l=>l(r)),t.length=0,r}e.load=o})(n.POSTPROCESSING||(n.POSTPROCESSING={})),(e=>{e.MAYBEMODULE=null;const t=[];function s(){return e.MODULE?Promise.resolve(e.MODULE):new Promise(r=>{t.push(r)})}e.ready=s;async function o(){if(e.MODULE)return e.MODULE;const r=await import("./postprocessing-TkXiVrjY.min.js").then(l=>l.N8AO);return e.MODULE=r,e.MAYBEMODULE=r,t.forEach(l=>l(r)),t.length=0,r}e.load=o})(n.POSTPROCESSING_AO||(n.POSTPROCESSING_AO={}))})(L||(L={}));var xt=(n=>(n[n.Average=0]="Average",n[n.Multiply=1]="Multiply",n[n.Minimum=2]="Minimum",n[n.Maximum=3]="Maximum",n))(xt||{}),Mu=(n=>(n[n.Discrete=0]="Discrete",n[n.Continuous=1]="Continuous",n))(Mu||{}),Qe=(n=>(n[n.None=0]="None",n[n.FreezePositionX=2]="FreezePositionX",n[n.FreezePositionY=4]="FreezePositionY",n[n.FreezePositionZ=8]="FreezePositionZ",n[n.FreezePosition=14]="FreezePosition",n[n.FreezeRotationX=16]="FreezeRotationX",n[n.FreezeRotationY=32]="FreezeRotationY",n[n.FreezeRotationZ=64]="FreezeRotationZ",n[n.FreezeRotation=112]="FreezeRotation",n[n.FreezeAll=126]="FreezeAll",n))(Qe||{}),Qa=(n=>(n[n.None=0]="None",n[n.X=2]="X",n[n.Y=4]="Y",n[n.Z=8]="Z",n[n.All=-1]="All",n))(Qa||{});const Tt=function(n,e){return function(t,s,o){dT(t,s,o,n,e)}};function dT(n,e,t,s,o){if(!o&&!s&&!n.onValidate)return;if(t!==void 0){console.error("Invalid usage of validate decorator. Only fields can be validated.",n,e,t),De("Invalid usage of validate decorator. Only fields can be validated. Property: "+e,Mi.Error);return}let r="";if(typeof e=="string"?r=e:r=e.name,n.__internalAwake){const l=Symbol(r),c=n.__internalAwake;n.__internalAwake=function(){var h;if(!this.onValidate){B()&&console.warn('Usage of @validate decorate detected but there is no onValidate method in your class: "'+((h=n.constructor)==null?void 0:h.name)+'"');return}if(this[l]===void 0){this[l]=this[r];const d=this[r];if(d instanceof ie||d instanceof S||d instanceof fe||d instanceof V){const u=this[r];kd(u,()=>{this.onValidate(r)})}Object.defineProperty(this,r,{set:function(u){var p;if(this[mf]===!0)this[l]=u;else{s?.call(this,u);const g=this[l];this[l]=u,(p=this.onValidate)==null||p.call(this,r,g)}},get:function(){return o?.call(this),this[l]}})}c.call(this)}}}const uT=function(n){return function(e,t,s){let o="";typeof t=="string"?o=t:o=t.name;const r=n.prototype,l=Object.getOwnPropertyDescriptor(r,o);if(!(l!=null&&l.value)){console.warn("Can not apply prefix: type does not have method named",t,n);return}const c=l.value,h=e[o];Object.defineProperty(r,o,{value:function(...d){const u=h?.call(this,...d);if(u instanceof Promise){u.then(p=>{if(p!==!1)return c.call(this,...d)});return}if(u!==!1)return c.call(this,...d)}})}};var pT=Object.defineProperty,mT=Object.getOwnPropertyDescriptor,Li=(n,e,t,s)=>{for(var o=s>1?void 0:s?mT(e,t):e,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=(s?l(e,t,o):l(o))||o);return s&&o&&pT(e,t,o),o};class gT{constructor(e,t){a(this,"positionChanged",!1),a(this,"rotationChanged",!1),a(this,"position"),a(this,"quaternion"),a(this,"_positionKeys",["x","y","z"]),a(this,"_quaternionKeys",["_x","_y","_z","_w"]),a(this,"mute",!1),a(this,"context"),a(this,"obj"),a(this,"_positionWatch"),a(this,"_rotationWatch"),this.context=t,this.obj=e}get isDirty(){return this.positionChanged||this.rotationChanged}reset(e=!1){if(this.positionChanged=!1,this.rotationChanged=!1,this.mute=!1,e){if(this.position)for(const t of this._positionKeys)delete this.position[t];if(this.quaternion)for(const t of this._quaternionKeys)delete this.quaternion[t]}}syncValues(){for(const e of this._positionKeys)this.position[e]=this.obj.position[e];for(const e of this._quaternionKeys)this.quaternion[e]=this.obj.quaternion[e]}applyValues(){if(this.positionChanged&&this.position)for(const e of this._positionKeys){const t=this.position[e];t!==void 0&&(this.obj.position[e]=t)}if(this.rotationChanged&&this.quaternion)for(const e of this._quaternionKeys){const t=this.quaternion[e];t!==void 0&&(this.obj.quaternion[e]=t)}}start(e,t){this.reset(),e&&(this._positionWatch||(this._positionWatch=new co(this.obj.position,["x","y","z"])),this._positionWatch.apply(),this.position={},this._positionWatch.subscribeWrite((r,l)=>{var c;if((c=this.context.physics.engine)!=null&&c.isUpdating||this.mute)return;const h=this.position[l];Math.abs(h-r)<1e-5||(this.position[l]=r,this.positionChanged=!0)})),t&&(this._rotationWatch||(this._rotationWatch=new co(this.obj.quaternion,["_x","_y","_z","_w"])),this._rotationWatch.apply(),this.quaternion={},this._rotationWatch.subscribeWrite((r,l)=>{var c;if((c=this.context.physics.engine)!=null&&c.isUpdating||this.mute)return;const h=this.quaternion[l];Math.abs(h-r)<1e-5||(this.quaternion[l]=r,this.rotationChanged=!0)}));const s=this.obj.matrixWorld.multiplyMatrices.bind(this.obj.matrixWorld),o=new ne;this.obj.matrixWorld.multiplyMatrices=(r,l)=>{var c;return(c=this.context.physics.engine)!=null&&c.isUpdating||this.mute||o.equals(r)||(this.positionChanged=!0,this.rotationChanged=!0,o.copy(r)),s(r,l)}}stop(){var e,t;(e=this._positionWatch)==null||e.revoke(),(t=this._rotationWatch)==null||t.revoke()}}var Ya;const ci=(Ya=class extends j{constructor(){super(...arguments),a(this,"autoMass",!0),a(this,"_mass",0),a(this,"useGravity",!0),a(this,"centerOfMass",new S(0,0,0)),a(this,"constraints",Qe.None),a(this,"isKinematic",!1),a(this,"drag",0),a(this,"angularDrag",1),a(this,"detectCollisions",!0),a(this,"sleepThreshold",.01),a(this,"collisionDetectionMode",Mu.Discrete),a(this,"_gravityScale",1),a(this,"dominanceGroup",0),a(this,"_propertiesChanged",!1),a(this,"_currentVelocity",new S),a(this,"_smoothedVelocity",new S),a(this,"_smoothedVelocityGetter",new S),a(this,"_lastPosition",new S),a(this,"_watch")}get isRigidbody(){return!0}set mass(n){n!==this._mass&&(this._mass=n,this._propertiesChanged=!0,this.__didAwake&&(this.autoMass=!1))}get mass(){var n,e;return this.autoMass?((e=(n=this.context.physics.engine)==null?void 0:n.getBody(this))==null?void 0:e.mass())??-1:this._mass}get lockPositionX(){return(this.constraints&Qe.FreezePositionX)!==0}get lockPositionY(){return(this.constraints&Qe.FreezePositionY)!==0}get lockPositionZ(){return(this.constraints&Qe.FreezePositionZ)!==0}get lockRotationX(){return(this.constraints&Qe.FreezeRotationX)!==0}get lockRotationY(){return(this.constraints&Qe.FreezeRotationY)!==0}get lockRotationZ(){return(this.constraints&Qe.FreezeRotationZ)!==0}set lockPositionX(n){n?this.constraints|=Qe.FreezePositionX:this.constraints&=~Qe.FreezePositionX}set lockPositionY(n){n?this.constraints|=Qe.FreezePositionY:this.constraints&=~Qe.FreezePositionY}set lockPositionZ(n){n?this.constraints|=Qe.FreezePositionZ:this.constraints&=~Qe.FreezePositionZ}set lockRotationX(n){n?this.constraints|=Qe.FreezeRotationX:this.constraints&=~Qe.FreezeRotationX}set lockRotationY(n){n?this.constraints|=Qe.FreezeRotationY:this.constraints&=~Qe.FreezeRotationY}set lockRotationZ(n){n?this.constraints|=Qe.FreezeRotationZ:this.constraints&=~Qe.FreezeRotationZ}set gravityScale(n){this._gravityScale=n}get gravityScale(){return this._gravityScale}awake(){this._watch=void 0,this._propertiesChanged=!1}onEnable(){this._watch||(this._watch=new gT(this.gameObject,this.context)),this._watch.start(!0,!0),this.startCoroutine(this.beforePhysics(),Oe.LateUpdate),B()&&(globalThis.NEEDLE_USE_RAPIER?L.RAPIER_PHYSICS.ready().then(async()=>{var n;await Ql(3),(n=this.context.physics.engine)!=null&&n.getBody(this)||console.warn(`Rigidbody could not be created. Ensure "${this.name}" has a Collider component.`)}):console.warn("Rigidbody could not be created: Rapier physics are explicitly disabled."))}onDisable(){var n,e;(n=this._watch)==null||n.stop(),(e=this.context.physics.engine)==null||e.removeBody(this)}onDestroy(){var n;(n=this.context.physics.engine)==null||n.removeBody(this)}onValidate(){this._propertiesChanged=!0}*beforePhysics(){for(var n,e,t,s;;)this._propertiesChanged&&(this._propertiesChanged=!1,(n=this.context.physics.engine)==null||n.updateProperties(this)),(e=this._watch)!=null&&e.isDirty?(this._watch.mute=!0,this._watch.applyValues(),(t=this.context.physics.engine)==null||t.updateBody(this,this._watch.positionChanged,this._watch.rotationChanged),this._watch.reset()):(s=this._watch)==null||s.syncValues(),this.captureVelocity(),yield}teleport(n,e=!0){var t;(t=this._watch)==null||t.reset(!0),e?this.gameObject.position.set(n.x,n.y,n.z):this.setWorldPosition(n.x,n.y,n.z),this.resetForcesAndTorques(),this.resetVelocities()}resetForces(n=!0){var e;(e=this.context.physics.engine)==null||e.resetForces(this,n)}resetTorques(n=!0){var e;(e=this.context.physics.engine)==null||e.resetTorques(this,n)}resetVelocities(){this.setVelocity(0,0,0),this.setAngularVelocity(0,0,0)}resetForcesAndTorques(){this.resetForces(),this.resetTorques()}wakeUp(){var n;(n=this.context.physics.engine)==null||n.wakeup(this)}get isSleeping(){var n;return(n=this.context.physics.engine)==null?void 0:n.isSleeping(this)}updateProperties(){var n;return this._propertiesChanged=!1,(n=this.context.physics.engine)==null?void 0:n.updateProperties(this)}applyForce(n,e,t=!0){var s;this._propertiesChanged&&this.updateProperties(),(s=this.context.physics.engine)==null||s.addForce(this,n,t)}applyImpulse(n,e=!0){var t;this._propertiesChanged&&this.updateProperties(),(t=this.context.physics.engine)==null||t.applyImpulse(this,n,e)}setForce(n,e,t,s=!0){var o,r,l;(o=this.context.physics.engine)==null||o.resetForces(this,s),typeof n=="number"?(e??(e=0),t??(t=0),(r=this.context.physics.engine)==null||r.addForce(this,{x:n,y:e,z:t},s)):(l=this.context.physics.engine)==null||l.addForce(this,n,s)}getVelocity(){var n;const e=(n=this.context.physics.engine)==null?void 0:n.getLinearVelocity(this);return e?(this._currentVelocity.x=e.x,this._currentVelocity.y=e.y,this._currentVelocity.z=e.z,this._currentVelocity):this._currentVelocity.set(0,0,0)}setVelocity(n,e,t,s=!0){var o,r;if(n instanceof S){const l=n;(o=this.context.physics.engine)==null||o.setLinearVelocity(this,l,s);return}e===void 0||t===void 0||(r=this.context.physics.engine)==null||r.setLinearVelocity(this,{x:n,y:e,z:t},s)}getAngularVelocity(){var n;const e=(n=this.context.physics.engine)==null?void 0:n.getAngularVelocity(this);return e?(this._currentVelocity.x=e.x,this._currentVelocity.y=e.y,this._currentVelocity.z=e.z,this._currentVelocity):this._currentVelocity.set(0,0,0)}setAngularVelocity(n,e,t,s=!0){var o,r;if(typeof n=="object"){const l=n;(o=this.context.physics.engine)==null||o.setAngularVelocity(this,l,s);return}if(e===void 0||t===void 0||typeof e=="boolean"){console.warn("setAngularVelocity expects either a Vec3 or 3 numbers");return}(r=this.context.physics.engine)==null||r.setAngularVelocity(this,{x:n,y:e,z:t},s)}setTorque(n,e,t){typeof n=="number"?this.setAngularVelocity(n,e,t):this.setAngularVelocity(n)}get smoothedVelocity(){return this._smoothedVelocityGetter.copy(this._smoothedVelocity),this._smoothedVelocityGetter.multiplyScalar(1/this.context.time.deltaTime)}setBodyFromGameObject(n=null){}captureVelocity(){const n=this.gameObject.matrixWorld;Ya.tempPosition.setFromMatrixPosition(n);const e=Ya.tempPosition.sub(this._lastPosition);this._lastPosition.copy(Ya.tempPosition),this._smoothedVelocity.lerp(e,this.context.time.deltaTime/.1)}},a(Ya,"tempPosition",new S),Ya);Li([Tt()],ci.prototype,"autoMass",2),Li([m()],ci.prototype,"mass",1),Li([Tt(),m()],ci.prototype,"useGravity",2),Li([m(S)],ci.prototype,"centerOfMass",2),Li([Tt(),m()],ci.prototype,"constraints",2),Li([Tt(),m()],ci.prototype,"isKinematic",2),Li([Tt(),m()],ci.prototype,"drag",2),Li([Tt(),m()],ci.prototype,"angularDrag",2),Li([Tt(),m()],ci.prototype,"detectCollisions",2),Li([Tt(),m()],ci.prototype,"sleepThreshold",2),Li([Tt(),m()],ci.prototype,"collisionDetectionMode",2),Li([Tt()],ci.prototype,"_gravityScale",2),Li([Tt()],ci.prototype,"dominanceGroup",2);let dt=ci;new S,new S;const To=C("debugsync"),jc="STRS";Eg(jc,ho.getRootAsSyncedTransformModel);const tn=new Hm;function xx(n,e,t=!0){tn.clear();const s=tn.createString(n);ho.startSyncedTransformModel(tn),ho.addGuid(tn,s),ho.addFast(tn,t);const o=e.worldPosition,r=e.worldEuler,l=e.gameObject.scale;ho.addTransform(tn,wx.createTransform(tn,o.x,o.y,o.z,r.x,r.y,r.z,l.x,l.y,l.z));const c=ho.endSyncedTransformModel(tn);return tn.finish(c,jc),tn.asUint8Array()}let Nf=0,Dc=0;ox(n=>{var e;const t=(e=n.connection.currentServerUrl)!=null&&e.includes("glitch")?10:40;Dc=Math.floor(Nf/t),Nf=0,To&&Dc>0&&console.log("Sync Transform Fast Interval",Dc)});class sn extends j{constructor(){super(...arguments),a(this,"overridePhysics",!0),a(this,"interpolatePosition",!0),a(this,"interpolateRotation",!0),a(this,"fastMode",!1),a(this,"syncDestroy",!1),a(this,"_model",null),a(this,"_needsUpdate",!0),a(this,"rb",null),a(this,"_wasKinematic",!1),a(this,"_receivedDataBefore",!1),a(this,"_targetPosition"),a(this,"_targetRotation"),a(this,"_receivedFastUpdate",!1),a(this,"_shouldRequestOwnership",!1),a(this,"joinedRoomCallback",null),a(this,"receivedDataCallback",null),a(this,"tempEuler",new Dt),a(this,"receivedUpdate",!1),a(this,"lastPosition"),a(this,"lastRotation"),a(this,"lastScale")}requestOwnership(){To&&console.log("Request ownership"),this._model?this._model.requestOwnership():(this._shouldRequestOwnership=!0,this._needsUpdate=!0)}freeOwnership(){var e;(e=this._model)==null||e.freeOwnership()}hasOwnership(){var e;return((e=this._model)==null?void 0:e.hasOwnership)??void 0}isOwned(){var e;return(e=this._model)==null?void 0:e.isOwned}awake(){To&&console.log("new instance",this.guid,this),this._receivedDataBefore=!1,this._targetPosition=new S,this._targetRotation=new V,this.lastPosition=new S,this.lastRotation=new V,this.lastScale=new S,this.rb=P.getComponentInChildren(this.gameObject,dt),this.rb&&(this._wasKinematic=this.rb.isKinematic),this.receivedUpdate=!0,this._model=new Ig(this.context.connection,this.guid),this.context.connection.isConnected&&this.tryGetLastState(),this.joinedRoomCallback=this.tryGetLastState.bind(this),this.context.connection.beginListen(se.JoinedRoom,this.joinedRoomCallback),this.receivedDataCallback=this.onReceivedData.bind(this),this.context.connection.beginListenBinary(jc,this.receivedDataCallback)}onDestroy(){this.syncDestroy&&of(this.guid,this.context.connection),this._model=null,this.context.connection.stopListen(se.JoinedRoom,this.joinedRoomCallback),this.context.connection.stopListenBinary(jc,this.receivedDataCallback)}tryGetLastState(){const e=this.context.connection.tryGetState(this.guid);e&&this.onReceivedData(e)}onReceivedData(e){var t;if(!this.destroyed&&typeof e.guid=="function"&&e.guid()===this.guid){To&&console.log("new data",this.context.connection.connectionId,this.context.time.frameCount,this.guid,e),this.receivedUpdate=!0,this._receivedFastUpdate=e.fast();const s=e.transform();if(s){ms.markDirty(this.gameObject,!0);const o=s.position();o&&(this.interpolatePosition&&((t=this._targetPosition)==null||t.set(o.x(),o.y(),o.z())),(!this.interpolatePosition||!this._receivedDataBefore)&&this.setWorldPosition(o.x(),o.y(),o.z()));const r=s.rotation();r&&(this.tempEuler.set(r.x(),r.y(),r.z()),this.interpolateRotation&&this._targetRotation.setFromEuler(this.tempEuler),(!this.interpolateRotation||!this._receivedDataBefore)&&mg(this.gameObject,this.tempEuler));const l=s.scale();l&&this.gameObject.scale.set(l.x(),l.y(),l.z())}this._receivedDataBefore=!0}}onEnable(){this.lastPosition.copy(this.worldPosition),this.lastRotation.copy(this.worldQuaternion),this.lastScale.copy(this.gameObject.scale),this._needsUpdate=!0,this._model&&this._model.updateIsOwned()}onDisable(){this._model&&this._model.freeOwnership()}onBeforeRender(){if(!this.activeAndEnabled||!this.context.connection.isConnected)return;if(!this.context.connection.isInRoom||!this._model){To&&console.log("no model or room",this.name,this.guid,this.context.connection.isInRoom);return}this._shouldRequestOwnership&&(this._shouldRequestOwnership=!1,this._model.requestOwnership());const e=this.worldPosition,t=this.worldQuaternion,s=this.gameObject.scale;if(this._model.isOwned&&!this.receivedUpdate){const l=this._model.hasOwnership||this.fastMode?1e-4:.001;(e.distanceTo(this.lastPosition)>l||t.angleTo(this.lastRotation)>l||s.distanceTo(this.lastScale)>l)&&(this._model.hasOwnership?this._needsUpdate=!0:(To&&console.log(this.guid,"reset because not owned but",this.gameObject.name,this.lastPosition),this.worldPosition=this.lastPosition,e.copy(this.lastPosition),this.worldQuaternion=this.lastRotation,t.copy(this.lastRotation),this.gameObject.scale.copy(this.lastScale),ms.markDirty(this.gameObject,!0),this._needsUpdate=!1))}if(this._model&&!this._model.hasOwnership&&this._model.isOwned&&this._receivedDataBefore){const l=this._receivedFastUpdate||this.fastMode?.5:.3;let c=!1;if(this.interpolatePosition&&this._targetPosition){const h=this.worldPosition;h.lerp(this._targetPosition,l),this.worldPosition=h,c=!0}if(this.interpolateRotation&&this._targetRotation){const h=this.worldQuaternion;h.slerp(this._targetRotation,l),this.worldQuaternion=h,c=!0}c&&ms.markDirty(this.gameObject,!0)}if(this.receivedUpdate=!1,this.lastPosition.copy(e),this.lastRotation.copy(t),this.lastScale.copy(s),!this._model||!this._model||this._model.hasOwnership===void 0||!this._model.hasOwnership)return;this.rb&&this.overridePhysics&&this._wasKinematic!==void 0&&(To&&console.log("reset kinematic",this.rb.name,this._wasKinematic),this.rb.isKinematic=this._wasKinematic);const o=10,r=this.rb||this.fastMode;if(this._needsUpdate&&(this.context.time.frameCount%o===0||r)){if(Nf++,r&&Dc>0&&this.context.time.frameCount%Dc!==0)return;To&&console.debug("[SyncedTransform] Send update",this.context.connection.connectionId,this.guid,this.gameObject.name,this.gameObject.guid),this._needsUpdate=!1;const l=xx(this.guid,this,!!r);this.context.connection.sendBinary(l)}}}class hd{constructor(e,t){a(this,"event"),a(this,"button"),a(this,"buttonName"),a(this,"_used",!1),a(this,"_propagationStopped",!1),a(this,"z__pointer_ctured",!1),a(this,"z__pointer_cture_rleased",!1),a(this,"inputSource"),a(this,"object"),a(this,"point"),a(this,"normal"),a(this,"face"),a(this,"distance"),a(this,"instanceId"),a(this,"intersection"),a(this,"isDown"),a(this,"isUp"),a(this,"isPressed"),a(this,"isClick"),a(this,"isDoubleClick"),a(this,"input"),this.event=t,this.input=e,this.button=t.button}get deviceIndex(){return this.event.deviceIndex}get pointerId(){return this.event.pointerId}get pressure(){return this.event.pressure}get used(){return this._used}use(){this._used||(this._used=!0,this.event.use())}get propagationStopped(){return this._propagationStopped}stopPropagation(){this._propagationStopped=!0,this.event.stopImmediatePropagation()}stopImmediatePropagation(){this._propagationStopped=!0,this.event.stopImmediatePropagation()}setPointerCapture(){this.z__pointer_ctured=!0}releasePointerCapture(){this.z__pointer_cture_rleased=!0}get mode(){return this.event.mode}clone(){const e=new hd(this.input,this.event);return Object.assign(e,this),e}Use(){this.use()}StopPropagation(){this.event.stopImmediatePropagation()}}function Ru(n,e){return P.foreachComponent(n,t=>{if(!t.enabled)return;const s=t;if(e)switch(e){case"pointerdown":if(s.onPointerDown)return!0;break;case"pointerup":if(s.onPointerUp||s.onPointerClick)return!0;break;case"pointermove":if(s.onPointerEnter||s.onPointerExit||s.onPointerMove)return!0;break}else if(s.onPointerDown||s.onPointerUp||s.onPointerEnter||s.onPointerExit||s.onPointerClick)return!0},!1)===!0}const Un=new Array;class zn{constructor(e,t,s,o){a(this,"enabled",!0),a(this,"target"),a(this,"methodName"),a(this,"arguments"),this.target=e,this.methodName=t||null,this.arguments=s,o!=null&&(this.enabled=o)}get canClone(){return this.target instanceof Object}invoke(...e){if(this.enabled!==!1){if(typeof this.target=="function")this.arguments?(Un.length=0,e!==void 0&&e.length>0&&Un.push(...e),Un.push(...this.arguments),this.target(...this.arguments),Un.length=0):this.target(...e);else if(this.methodName!=null){const t=this.target[this.methodName];typeof t=="function"?this.arguments?(Un.length=0,e!==void 0&&e.length>0&&Un.push(...e),Un.push(...this.arguments),t.call(this.target,...Un),Un.length=0):t.call(this.target,...e):this.arguments?this.target[this.methodName]=this.arguments[0]||e[0]:this.target[this.methodName]=e[0]}}}}const fT=n=>/^[A-Z]*$/.test(n);class Tu extends Event{constructor(){super(...arguments),a(this,"args")}}class xe{constructor(e){if(a(this,"isEventList",!0),a(this,"target"),a(this,"key"),a(this,"_isInvoking",!1),a(this,"methods",[]),a(this,"_methodsCopy",[]),this.methods=[],Array.isArray(e))for(const t of e)t instanceof zn?this.methods.push(t):typeof t=="function"&&this.methods.push(new zn(t));else typeof e=="function"&&this.methods.push(new zn(e))}__internalOnInstantiate(e){var t;const s=new Array;for(let o=0;o<this.methods.length;o++){const r=this.methods[o];if(!(r.target instanceof Function)){const l=r.target;let c=l?.uuid;if(l&&(c=l.guid),c){const h=e[c];if(h){const d=(t=r.arguments)==null?void 0:t.map(u=>u instanceof Object&&u.uuid?e[u.uuid]:u!=null&&u.isComponent?e[u.guid]:u);s.push(new zn(h.clone,r.methodName,d,r.enabled))}else B()&&console.warn("Could not find target for event listener")}}}return new xe(s)}setEventTarget(e,t){if(this.key=e,this.target=t,this.key!==void 0){let s="",o=!1;for(const r of this.key)o&&fT(r)&&(s+="-"),o=!0,s+=r.toLowerCase();this.key=s}}get listenerCount(){var e;return((e=this.methods)==null?void 0:e.length)??0}get isInvoking(){return this._isInvoking}static from(...e){return new xe(e)}invoke(...e){var t;if(this._isInvoking)return console.warn("Circular event invocation detected. Please check your event listeners for circular references.",this),!1;if(((t=this.methods)==null?void 0:t.length)<=0)return!1;this._isInvoking=!0;try{this._methodsCopy.length=0,this._methodsCopy.push(...this.methods);for(const s of this._methodsCopy)s.invoke(...e);if(typeof this.target=="object"&&typeof this.key=="string"){const s=this.target.dispatchEvent;if(typeof s=="function"){const o=new Tu(this.key);o.args=e,s.call(this.target,o)}}}finally{this._isInvoking=!1,this._methodsCopy.length=0}return!0}addEventListener(e){return this.methods.push(new zn(e)),e}removeEventListener(e){if(e)for(let t=this.methods.length-1;t>=0;t--)this.methods[t].target===e&&(this.methods[t].enabled=!1,this.methods.splice(t,1))}removeAllEventListeners(){this.methods.length=0}}class yT extends es{constructor(){super([re,he],"ColorSerializer")}onDeserialize(e){if(e!=null)return e.a!==void 0?new he(e.r,e.g,e.b,e.a):e.alpha!==void 0?new he(e.r,e.g,e.b,e.alpha):new re(e.r,e.g,e.b)}onSerialize(e){if(e!=null)return e.a!==void 0?{r:e.r,g:e.g,b:e.b,a:e.a}:{r:e.r,g:e.g,b:e.b}}}const vT=new yT;class bT extends es{constructor(){super([Dt],"EulerSerializer")}onDeserialize(e,t){if(e!=null){if(e.order)return new Dt(e.x,e.y,e.z,e.order);if(e.x!=null)return new Dt(e.x,e.y,e.z)}}onSerialize(e,t){return{x:e.x,y:e.y,z:e.z,order:e.order}}}const _T=new bT;class wT extends es{constructor(){super(A,"ObjectSerializer")}onSerialize(e,t){if(t.objectToNode!==void 0&&e.uuid){const s=t.objectToNode[e.uuid];return wt&&console.log(s,e.name,e.uuid),{node:s}}}onDeserialize(e,t){var s,o,r;if(typeof e=="string"){if(e.endsWith(".glb")||e.endsWith(".gltf")){if(t.serializable instanceof Array&&t.serializable.includes(ce))return;B()&&be("Detected wrong usage of @serializable with Object3D or GameObject. Instead you should use AssetReference here! Please see the console for details.");const l=(o=(s=t.target)==null?void 0:s.constructor)==null?void 0:o.name;console.warn(`Wrong usage of @serializable detected in your script "${l}"
|
|
928
|
+
`;var hT=Object.defineProperty,zf=(n,e,t,s)=>{for(var o=void 0,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=l(e,t,o)||o);return o&&hT(e,t,o),o};class Br extends j{constructor(){super(...arguments),a(this,"constraintActive",!0),a(this,"locked",!1),a(this,"sources",[])}}zf([m()],Br.prototype,"constraintActive"),zf([m()],Br.prototype,"locked"),zf([m(A)],Br.prototype,"sources");let Fr=class{constructor(){a(this,"bb",null),a(this,"bb_pos",0)}__init(n,e){return this.bb_pos=n,this.bb=e,this}x(){return this.bb.readFloat32(this.bb_pos)}y(){return this.bb.readFloat32(this.bb_pos+4)}z(){return this.bb.readFloat32(this.bb_pos+8)}static sizeOf(){return 12}static createVec3(n,e,t,s){return n.prep(4,12),n.writeFloat32(s),n.writeFloat32(t),n.writeFloat32(e),n.offset()}};class wx{constructor(){a(this,"bb",null),a(this,"bb_pos",0)}__init(e,t){return this.bb_pos=e,this.bb=t,this}position(e){return(e||new Fr).__init(this.bb_pos,this.bb)}rotation(e){return(e||new Fr).__init(this.bb_pos+12,this.bb)}scale(e){return(e||new Fr).__init(this.bb_pos+24,this.bb)}static sizeOf(){return 36}static createTransform(e,t,s,o,r,l,c,h,d,u){return e.prep(4,36),e.prep(4,12),e.writeFloat32(u),e.writeFloat32(d),e.writeFloat32(h),e.prep(4,12),e.writeFloat32(c),e.writeFloat32(l),e.writeFloat32(r),e.prep(4,12),e.writeFloat32(o),e.writeFloat32(s),e.writeFloat32(t),e.offset()}}class ho{constructor(){a(this,"bb",null),a(this,"bb_pos",0)}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSyncedTransformModel(e,t){return(t||new ho).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSyncedTransformModel(e,t){return e.setPosition(e.position()+Jv),(t||new ho).__init(e.readInt32(e.position())+e.position(),e)}guid(e){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}fast(){const e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}transform(e){const t=this.bb.__offset(this.bb_pos,8);return t?(e||new wx).__init(this.bb_pos+t,this.bb):null}dontSave(){const e=this.bb.__offset(this.bb_pos,10);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startSyncedTransformModel(e){e.startObject(4)}static addGuid(e,t){e.addFieldOffset(0,t,0)}static addFast(e,t){e.addFieldInt8(1,+t,0)}static addTransform(e,t){e.addFieldStruct(2,t,0)}static addDontSave(e,t){e.addFieldInt8(3,+t,0)}static endSyncedTransformModel(e){return e.endObject()}static finishSyncedTransformModelBuffer(e,t){e.finish(t)}static finishSizePrefixedSyncedTransformModelBuffer(e,t){e.finish(t,void 0,!0)}}var L;(n=>{(e=>{e.MAYBEMODULE=null;const t=[];function s(){return e.MODULE?Promise.resolve(e.MODULE):new Promise(r=>{t.push(r)})}e.ready=s;async function o(){if(e.MODULE)return e.MODULE;const r=await import("./rapier-CyWhltHY.min.js");return e.MODULE=r,e.MAYBEMODULE=r,t.forEach(l=>l(r)),t.length=0,r}e.load=o})(n.RAPIER_PHYSICS||(n.RAPIER_PHYSICS={})),(e=>{e.MAYBEMODULE=null;const t=[];function s(){return e.MODULE?Promise.resolve(e.MODULE):new Promise(r=>{t.push(r)})}e.ready=s;async function o(){if(e.MODULE)return e.MODULE;const r=await import("./postprocessing-BzY0H7ry.min.js").then(l=>l.index);return e.MODULE=r,e.MAYBEMODULE=r,t.forEach(l=>l(r)),t.length=0,r}e.load=o})(n.POSTPROCESSING||(n.POSTPROCESSING={})),(e=>{e.MAYBEMODULE=null;const t=[];function s(){return e.MODULE?Promise.resolve(e.MODULE):new Promise(r=>{t.push(r)})}e.ready=s;async function o(){if(e.MODULE)return e.MODULE;const r=await import("./postprocessing-BzY0H7ry.min.js").then(l=>l.N8AO);return e.MODULE=r,e.MAYBEMODULE=r,t.forEach(l=>l(r)),t.length=0,r}e.load=o})(n.POSTPROCESSING_AO||(n.POSTPROCESSING_AO={}))})(L||(L={}));var xt=(n=>(n[n.Average=0]="Average",n[n.Multiply=1]="Multiply",n[n.Minimum=2]="Minimum",n[n.Maximum=3]="Maximum",n))(xt||{}),Mu=(n=>(n[n.Discrete=0]="Discrete",n[n.Continuous=1]="Continuous",n))(Mu||{}),Qe=(n=>(n[n.None=0]="None",n[n.FreezePositionX=2]="FreezePositionX",n[n.FreezePositionY=4]="FreezePositionY",n[n.FreezePositionZ=8]="FreezePositionZ",n[n.FreezePosition=14]="FreezePosition",n[n.FreezeRotationX=16]="FreezeRotationX",n[n.FreezeRotationY=32]="FreezeRotationY",n[n.FreezeRotationZ=64]="FreezeRotationZ",n[n.FreezeRotation=112]="FreezeRotation",n[n.FreezeAll=126]="FreezeAll",n))(Qe||{}),Qa=(n=>(n[n.None=0]="None",n[n.X=2]="X",n[n.Y=4]="Y",n[n.Z=8]="Z",n[n.All=-1]="All",n))(Qa||{});const Tt=function(n,e){return function(t,s,o){dT(t,s,o,n,e)}};function dT(n,e,t,s,o){if(!o&&!s&&!n.onValidate)return;if(t!==void 0){console.error("Invalid usage of validate decorator. Only fields can be validated.",n,e,t),De("Invalid usage of validate decorator. Only fields can be validated. Property: "+e,Mi.Error);return}let r="";if(typeof e=="string"?r=e:r=e.name,n.__internalAwake){const l=Symbol(r),c=n.__internalAwake;n.__internalAwake=function(){var h;if(!this.onValidate){B()&&console.warn('Usage of @validate decorate detected but there is no onValidate method in your class: "'+((h=n.constructor)==null?void 0:h.name)+'"');return}if(this[l]===void 0){this[l]=this[r];const d=this[r];if(d instanceof ie||d instanceof S||d instanceof fe||d instanceof V){const u=this[r];kd(u,()=>{this.onValidate(r)})}Object.defineProperty(this,r,{set:function(u){var p;if(this[mf]===!0)this[l]=u;else{s?.call(this,u);const g=this[l];this[l]=u,(p=this.onValidate)==null||p.call(this,r,g)}},get:function(){return o?.call(this),this[l]}})}c.call(this)}}}const uT=function(n){return function(e,t,s){let o="";typeof t=="string"?o=t:o=t.name;const r=n.prototype,l=Object.getOwnPropertyDescriptor(r,o);if(!(l!=null&&l.value)){console.warn("Can not apply prefix: type does not have method named",t,n);return}const c=l.value,h=e[o];Object.defineProperty(r,o,{value:function(...d){const u=h?.call(this,...d);if(u instanceof Promise){u.then(p=>{if(p!==!1)return c.call(this,...d)});return}if(u!==!1)return c.call(this,...d)}})}};var pT=Object.defineProperty,mT=Object.getOwnPropertyDescriptor,Li=(n,e,t,s)=>{for(var o=s>1?void 0:s?mT(e,t):e,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=(s?l(e,t,o):l(o))||o);return s&&o&&pT(e,t,o),o};class gT{constructor(e,t){a(this,"positionChanged",!1),a(this,"rotationChanged",!1),a(this,"position"),a(this,"quaternion"),a(this,"_positionKeys",["x","y","z"]),a(this,"_quaternionKeys",["_x","_y","_z","_w"]),a(this,"mute",!1),a(this,"context"),a(this,"obj"),a(this,"_positionWatch"),a(this,"_rotationWatch"),this.context=t,this.obj=e}get isDirty(){return this.positionChanged||this.rotationChanged}reset(e=!1){if(this.positionChanged=!1,this.rotationChanged=!1,this.mute=!1,e){if(this.position)for(const t of this._positionKeys)delete this.position[t];if(this.quaternion)for(const t of this._quaternionKeys)delete this.quaternion[t]}}syncValues(){for(const e of this._positionKeys)this.position[e]=this.obj.position[e];for(const e of this._quaternionKeys)this.quaternion[e]=this.obj.quaternion[e]}applyValues(){if(this.positionChanged&&this.position)for(const e of this._positionKeys){const t=this.position[e];t!==void 0&&(this.obj.position[e]=t)}if(this.rotationChanged&&this.quaternion)for(const e of this._quaternionKeys){const t=this.quaternion[e];t!==void 0&&(this.obj.quaternion[e]=t)}}start(e,t){this.reset(),e&&(this._positionWatch||(this._positionWatch=new co(this.obj.position,["x","y","z"])),this._positionWatch.apply(),this.position={},this._positionWatch.subscribeWrite((r,l)=>{var c;if((c=this.context.physics.engine)!=null&&c.isUpdating||this.mute)return;const h=this.position[l];Math.abs(h-r)<1e-5||(this.position[l]=r,this.positionChanged=!0)})),t&&(this._rotationWatch||(this._rotationWatch=new co(this.obj.quaternion,["_x","_y","_z","_w"])),this._rotationWatch.apply(),this.quaternion={},this._rotationWatch.subscribeWrite((r,l)=>{var c;if((c=this.context.physics.engine)!=null&&c.isUpdating||this.mute)return;const h=this.quaternion[l];Math.abs(h-r)<1e-5||(this.quaternion[l]=r,this.rotationChanged=!0)}));const s=this.obj.matrixWorld.multiplyMatrices.bind(this.obj.matrixWorld),o=new ne;this.obj.matrixWorld.multiplyMatrices=(r,l)=>{var c;return(c=this.context.physics.engine)!=null&&c.isUpdating||this.mute||o.equals(r)||(this.positionChanged=!0,this.rotationChanged=!0,o.copy(r)),s(r,l)}}stop(){var e,t;(e=this._positionWatch)==null||e.revoke(),(t=this._rotationWatch)==null||t.revoke()}}var Ya;const ci=(Ya=class extends j{constructor(){super(...arguments),a(this,"autoMass",!0),a(this,"_mass",0),a(this,"useGravity",!0),a(this,"centerOfMass",new S(0,0,0)),a(this,"constraints",Qe.None),a(this,"isKinematic",!1),a(this,"drag",0),a(this,"angularDrag",1),a(this,"detectCollisions",!0),a(this,"sleepThreshold",.01),a(this,"collisionDetectionMode",Mu.Discrete),a(this,"_gravityScale",1),a(this,"dominanceGroup",0),a(this,"_propertiesChanged",!1),a(this,"_currentVelocity",new S),a(this,"_smoothedVelocity",new S),a(this,"_smoothedVelocityGetter",new S),a(this,"_lastPosition",new S),a(this,"_watch")}get isRigidbody(){return!0}set mass(n){n!==this._mass&&(this._mass=n,this._propertiesChanged=!0,this.__didAwake&&(this.autoMass=!1))}get mass(){var n,e;return this.autoMass?((e=(n=this.context.physics.engine)==null?void 0:n.getBody(this))==null?void 0:e.mass())??-1:this._mass}get lockPositionX(){return(this.constraints&Qe.FreezePositionX)!==0}get lockPositionY(){return(this.constraints&Qe.FreezePositionY)!==0}get lockPositionZ(){return(this.constraints&Qe.FreezePositionZ)!==0}get lockRotationX(){return(this.constraints&Qe.FreezeRotationX)!==0}get lockRotationY(){return(this.constraints&Qe.FreezeRotationY)!==0}get lockRotationZ(){return(this.constraints&Qe.FreezeRotationZ)!==0}set lockPositionX(n){n?this.constraints|=Qe.FreezePositionX:this.constraints&=~Qe.FreezePositionX}set lockPositionY(n){n?this.constraints|=Qe.FreezePositionY:this.constraints&=~Qe.FreezePositionY}set lockPositionZ(n){n?this.constraints|=Qe.FreezePositionZ:this.constraints&=~Qe.FreezePositionZ}set lockRotationX(n){n?this.constraints|=Qe.FreezeRotationX:this.constraints&=~Qe.FreezeRotationX}set lockRotationY(n){n?this.constraints|=Qe.FreezeRotationY:this.constraints&=~Qe.FreezeRotationY}set lockRotationZ(n){n?this.constraints|=Qe.FreezeRotationZ:this.constraints&=~Qe.FreezeRotationZ}set gravityScale(n){this._gravityScale=n}get gravityScale(){return this._gravityScale}awake(){this._watch=void 0,this._propertiesChanged=!1}onEnable(){this._watch||(this._watch=new gT(this.gameObject,this.context)),this._watch.start(!0,!0),this.startCoroutine(this.beforePhysics(),Oe.LateUpdate),B()&&(globalThis.NEEDLE_USE_RAPIER?L.RAPIER_PHYSICS.ready().then(async()=>{var n;await Ql(3),(n=this.context.physics.engine)!=null&&n.getBody(this)||console.warn(`Rigidbody could not be created. Ensure "${this.name}" has a Collider component.`)}):console.warn("Rigidbody could not be created: Rapier physics are explicitly disabled."))}onDisable(){var n,e;(n=this._watch)==null||n.stop(),(e=this.context.physics.engine)==null||e.removeBody(this)}onDestroy(){var n;(n=this.context.physics.engine)==null||n.removeBody(this)}onValidate(){this._propertiesChanged=!0}*beforePhysics(){for(var n,e,t,s;;)this._propertiesChanged&&(this._propertiesChanged=!1,(n=this.context.physics.engine)==null||n.updateProperties(this)),(e=this._watch)!=null&&e.isDirty?(this._watch.mute=!0,this._watch.applyValues(),(t=this.context.physics.engine)==null||t.updateBody(this,this._watch.positionChanged,this._watch.rotationChanged),this._watch.reset()):(s=this._watch)==null||s.syncValues(),this.captureVelocity(),yield}teleport(n,e=!0){var t;(t=this._watch)==null||t.reset(!0),e?this.gameObject.position.set(n.x,n.y,n.z):this.setWorldPosition(n.x,n.y,n.z),this.resetForcesAndTorques(),this.resetVelocities()}resetForces(n=!0){var e;(e=this.context.physics.engine)==null||e.resetForces(this,n)}resetTorques(n=!0){var e;(e=this.context.physics.engine)==null||e.resetTorques(this,n)}resetVelocities(){this.setVelocity(0,0,0),this.setAngularVelocity(0,0,0)}resetForcesAndTorques(){this.resetForces(),this.resetTorques()}wakeUp(){var n;(n=this.context.physics.engine)==null||n.wakeup(this)}get isSleeping(){var n;return(n=this.context.physics.engine)==null?void 0:n.isSleeping(this)}updateProperties(){var n;return this._propertiesChanged=!1,(n=this.context.physics.engine)==null?void 0:n.updateProperties(this)}applyForce(n,e,t=!0){var s;this._propertiesChanged&&this.updateProperties(),(s=this.context.physics.engine)==null||s.addForce(this,n,t)}applyImpulse(n,e=!0){var t;this._propertiesChanged&&this.updateProperties(),(t=this.context.physics.engine)==null||t.applyImpulse(this,n,e)}setForce(n,e,t,s=!0){var o,r,l;(o=this.context.physics.engine)==null||o.resetForces(this,s),typeof n=="number"?(e??(e=0),t??(t=0),(r=this.context.physics.engine)==null||r.addForce(this,{x:n,y:e,z:t},s)):(l=this.context.physics.engine)==null||l.addForce(this,n,s)}getVelocity(){var n;const e=(n=this.context.physics.engine)==null?void 0:n.getLinearVelocity(this);return e?(this._currentVelocity.x=e.x,this._currentVelocity.y=e.y,this._currentVelocity.z=e.z,this._currentVelocity):this._currentVelocity.set(0,0,0)}setVelocity(n,e,t,s=!0){var o,r;if(n instanceof S){const l=n;(o=this.context.physics.engine)==null||o.setLinearVelocity(this,l,s);return}e===void 0||t===void 0||(r=this.context.physics.engine)==null||r.setLinearVelocity(this,{x:n,y:e,z:t},s)}getAngularVelocity(){var n;const e=(n=this.context.physics.engine)==null?void 0:n.getAngularVelocity(this);return e?(this._currentVelocity.x=e.x,this._currentVelocity.y=e.y,this._currentVelocity.z=e.z,this._currentVelocity):this._currentVelocity.set(0,0,0)}setAngularVelocity(n,e,t,s=!0){var o,r;if(typeof n=="object"){const l=n;(o=this.context.physics.engine)==null||o.setAngularVelocity(this,l,s);return}if(e===void 0||t===void 0||typeof e=="boolean"){console.warn("setAngularVelocity expects either a Vec3 or 3 numbers");return}(r=this.context.physics.engine)==null||r.setAngularVelocity(this,{x:n,y:e,z:t},s)}setTorque(n,e,t){typeof n=="number"?this.setAngularVelocity(n,e,t):this.setAngularVelocity(n)}get smoothedVelocity(){return this._smoothedVelocityGetter.copy(this._smoothedVelocity),this._smoothedVelocityGetter.multiplyScalar(1/this.context.time.deltaTime)}setBodyFromGameObject(n=null){}captureVelocity(){const n=this.gameObject.matrixWorld;Ya.tempPosition.setFromMatrixPosition(n);const e=Ya.tempPosition.sub(this._lastPosition);this._lastPosition.copy(Ya.tempPosition),this._smoothedVelocity.lerp(e,this.context.time.deltaTime/.1)}},a(Ya,"tempPosition",new S),Ya);Li([Tt()],ci.prototype,"autoMass",2),Li([m()],ci.prototype,"mass",1),Li([Tt(),m()],ci.prototype,"useGravity",2),Li([m(S)],ci.prototype,"centerOfMass",2),Li([Tt(),m()],ci.prototype,"constraints",2),Li([Tt(),m()],ci.prototype,"isKinematic",2),Li([Tt(),m()],ci.prototype,"drag",2),Li([Tt(),m()],ci.prototype,"angularDrag",2),Li([Tt(),m()],ci.prototype,"detectCollisions",2),Li([Tt(),m()],ci.prototype,"sleepThreshold",2),Li([Tt(),m()],ci.prototype,"collisionDetectionMode",2),Li([Tt()],ci.prototype,"_gravityScale",2),Li([Tt()],ci.prototype,"dominanceGroup",2);let dt=ci;new S,new S;const To=C("debugsync"),jc="STRS";Eg(jc,ho.getRootAsSyncedTransformModel);const tn=new Hm;function xx(n,e,t=!0){tn.clear();const s=tn.createString(n);ho.startSyncedTransformModel(tn),ho.addGuid(tn,s),ho.addFast(tn,t);const o=e.worldPosition,r=e.worldEuler,l=e.gameObject.scale;ho.addTransform(tn,wx.createTransform(tn,o.x,o.y,o.z,r.x,r.y,r.z,l.x,l.y,l.z));const c=ho.endSyncedTransformModel(tn);return tn.finish(c,jc),tn.asUint8Array()}let Nf=0,Dc=0;ox(n=>{var e;const t=(e=n.connection.currentServerUrl)!=null&&e.includes("glitch")?10:40;Dc=Math.floor(Nf/t),Nf=0,To&&Dc>0&&console.log("Sync Transform Fast Interval",Dc)});class sn extends j{constructor(){super(...arguments),a(this,"overridePhysics",!0),a(this,"interpolatePosition",!0),a(this,"interpolateRotation",!0),a(this,"fastMode",!1),a(this,"syncDestroy",!1),a(this,"_model",null),a(this,"_needsUpdate",!0),a(this,"rb",null),a(this,"_wasKinematic",!1),a(this,"_receivedDataBefore",!1),a(this,"_targetPosition"),a(this,"_targetRotation"),a(this,"_receivedFastUpdate",!1),a(this,"_shouldRequestOwnership",!1),a(this,"joinedRoomCallback",null),a(this,"receivedDataCallback",null),a(this,"tempEuler",new Dt),a(this,"receivedUpdate",!1),a(this,"lastPosition"),a(this,"lastRotation"),a(this,"lastScale")}requestOwnership(){To&&console.log("Request ownership"),this._model?this._model.requestOwnership():(this._shouldRequestOwnership=!0,this._needsUpdate=!0)}freeOwnership(){var e;(e=this._model)==null||e.freeOwnership()}hasOwnership(){var e;return((e=this._model)==null?void 0:e.hasOwnership)??void 0}isOwned(){var e;return(e=this._model)==null?void 0:e.isOwned}awake(){To&&console.log("new instance",this.guid,this),this._receivedDataBefore=!1,this._targetPosition=new S,this._targetRotation=new V,this.lastPosition=new S,this.lastRotation=new V,this.lastScale=new S,this.rb=P.getComponentInChildren(this.gameObject,dt),this.rb&&(this._wasKinematic=this.rb.isKinematic),this.receivedUpdate=!0,this._model=new Ig(this.context.connection,this.guid),this.context.connection.isConnected&&this.tryGetLastState(),this.joinedRoomCallback=this.tryGetLastState.bind(this),this.context.connection.beginListen(se.JoinedRoom,this.joinedRoomCallback),this.receivedDataCallback=this.onReceivedData.bind(this),this.context.connection.beginListenBinary(jc,this.receivedDataCallback)}onDestroy(){this.syncDestroy&&of(this.guid,this.context.connection),this._model=null,this.context.connection.stopListen(se.JoinedRoom,this.joinedRoomCallback),this.context.connection.stopListenBinary(jc,this.receivedDataCallback)}tryGetLastState(){const e=this.context.connection.tryGetState(this.guid);e&&this.onReceivedData(e)}onReceivedData(e){var t;if(!this.destroyed&&typeof e.guid=="function"&&e.guid()===this.guid){To&&console.log("new data",this.context.connection.connectionId,this.context.time.frameCount,this.guid,e),this.receivedUpdate=!0,this._receivedFastUpdate=e.fast();const s=e.transform();if(s){ms.markDirty(this.gameObject,!0);const o=s.position();o&&(this.interpolatePosition&&((t=this._targetPosition)==null||t.set(o.x(),o.y(),o.z())),(!this.interpolatePosition||!this._receivedDataBefore)&&this.setWorldPosition(o.x(),o.y(),o.z()));const r=s.rotation();r&&(this.tempEuler.set(r.x(),r.y(),r.z()),this.interpolateRotation&&this._targetRotation.setFromEuler(this.tempEuler),(!this.interpolateRotation||!this._receivedDataBefore)&&mg(this.gameObject,this.tempEuler));const l=s.scale();l&&this.gameObject.scale.set(l.x(),l.y(),l.z())}this._receivedDataBefore=!0}}onEnable(){this.lastPosition.copy(this.worldPosition),this.lastRotation.copy(this.worldQuaternion),this.lastScale.copy(this.gameObject.scale),this._needsUpdate=!0,this._model&&this._model.updateIsOwned()}onDisable(){this._model&&this._model.freeOwnership()}onBeforeRender(){if(!this.activeAndEnabled||!this.context.connection.isConnected)return;if(!this.context.connection.isInRoom||!this._model){To&&console.log("no model or room",this.name,this.guid,this.context.connection.isInRoom);return}this._shouldRequestOwnership&&(this._shouldRequestOwnership=!1,this._model.requestOwnership());const e=this.worldPosition,t=this.worldQuaternion,s=this.gameObject.scale;if(this._model.isOwned&&!this.receivedUpdate){const l=this._model.hasOwnership||this.fastMode?1e-4:.001;(e.distanceTo(this.lastPosition)>l||t.angleTo(this.lastRotation)>l||s.distanceTo(this.lastScale)>l)&&(this._model.hasOwnership?this._needsUpdate=!0:(To&&console.log(this.guid,"reset because not owned but",this.gameObject.name,this.lastPosition),this.worldPosition=this.lastPosition,e.copy(this.lastPosition),this.worldQuaternion=this.lastRotation,t.copy(this.lastRotation),this.gameObject.scale.copy(this.lastScale),ms.markDirty(this.gameObject,!0),this._needsUpdate=!1))}if(this._model&&!this._model.hasOwnership&&this._model.isOwned&&this._receivedDataBefore){const l=this._receivedFastUpdate||this.fastMode?.5:.3;let c=!1;if(this.interpolatePosition&&this._targetPosition){const h=this.worldPosition;h.lerp(this._targetPosition,l),this.worldPosition=h,c=!0}if(this.interpolateRotation&&this._targetRotation){const h=this.worldQuaternion;h.slerp(this._targetRotation,l),this.worldQuaternion=h,c=!0}c&&ms.markDirty(this.gameObject,!0)}if(this.receivedUpdate=!1,this.lastPosition.copy(e),this.lastRotation.copy(t),this.lastScale.copy(s),!this._model||!this._model||this._model.hasOwnership===void 0||!this._model.hasOwnership)return;this.rb&&this.overridePhysics&&this._wasKinematic!==void 0&&(To&&console.log("reset kinematic",this.rb.name,this._wasKinematic),this.rb.isKinematic=this._wasKinematic);const o=10,r=this.rb||this.fastMode;if(this._needsUpdate&&(this.context.time.frameCount%o===0||r)){if(Nf++,r&&Dc>0&&this.context.time.frameCount%Dc!==0)return;To&&console.debug("[SyncedTransform] Send update",this.context.connection.connectionId,this.guid,this.gameObject.name,this.gameObject.guid),this._needsUpdate=!1;const l=xx(this.guid,this,!!r);this.context.connection.sendBinary(l)}}}class hd{constructor(e,t){a(this,"event"),a(this,"button"),a(this,"buttonName"),a(this,"_used",!1),a(this,"_propagationStopped",!1),a(this,"z__pointer_ctured",!1),a(this,"z__pointer_cture_rleased",!1),a(this,"inputSource"),a(this,"object"),a(this,"point"),a(this,"normal"),a(this,"face"),a(this,"distance"),a(this,"instanceId"),a(this,"intersection"),a(this,"isDown"),a(this,"isUp"),a(this,"isPressed"),a(this,"isClick"),a(this,"isDoubleClick"),a(this,"input"),this.event=t,this.input=e,this.button=t.button}get deviceIndex(){return this.event.deviceIndex}get pointerId(){return this.event.pointerId}get pressure(){return this.event.pressure}get used(){return this._used}use(){this._used||(this._used=!0,this.event.use())}get propagationStopped(){return this._propagationStopped}stopPropagation(){this._propagationStopped=!0,this.event.stopImmediatePropagation()}stopImmediatePropagation(){this._propagationStopped=!0,this.event.stopImmediatePropagation()}setPointerCapture(){this.z__pointer_ctured=!0}releasePointerCapture(){this.z__pointer_cture_rleased=!0}get mode(){return this.event.mode}clone(){const e=new hd(this.input,this.event);return Object.assign(e,this),e}Use(){this.use()}StopPropagation(){this.event.stopImmediatePropagation()}}function Ru(n,e){return P.foreachComponent(n,t=>{if(!t.enabled)return;const s=t;if(e)switch(e){case"pointerdown":if(s.onPointerDown)return!0;break;case"pointerup":if(s.onPointerUp||s.onPointerClick)return!0;break;case"pointermove":if(s.onPointerEnter||s.onPointerExit||s.onPointerMove)return!0;break}else if(s.onPointerDown||s.onPointerUp||s.onPointerEnter||s.onPointerExit||s.onPointerClick)return!0},!1)===!0}const Un=new Array;class zn{constructor(e,t,s,o){a(this,"enabled",!0),a(this,"target"),a(this,"methodName"),a(this,"arguments"),this.target=e,this.methodName=t||null,this.arguments=s,o!=null&&(this.enabled=o)}get canClone(){return this.target instanceof Object}invoke(...e){if(this.enabled!==!1){if(typeof this.target=="function")this.arguments?(Un.length=0,e!==void 0&&e.length>0&&Un.push(...e),Un.push(...this.arguments),this.target(...this.arguments),Un.length=0):this.target(...e);else if(this.methodName!=null){const t=this.target[this.methodName];typeof t=="function"?this.arguments?(Un.length=0,e!==void 0&&e.length>0&&Un.push(...e),Un.push(...this.arguments),t.call(this.target,...Un),Un.length=0):t.call(this.target,...e):this.arguments?this.target[this.methodName]=this.arguments[0]||e[0]:this.target[this.methodName]=e[0]}}}}const fT=n=>/^[A-Z]*$/.test(n);class Tu extends Event{constructor(){super(...arguments),a(this,"args")}}class xe{constructor(e){if(a(this,"isEventList",!0),a(this,"target"),a(this,"key"),a(this,"_isInvoking",!1),a(this,"methods",[]),a(this,"_methodsCopy",[]),this.methods=[],Array.isArray(e))for(const t of e)t instanceof zn?this.methods.push(t):typeof t=="function"&&this.methods.push(new zn(t));else typeof e=="function"&&this.methods.push(new zn(e))}__internalOnInstantiate(e){var t;const s=new Array;for(let o=0;o<this.methods.length;o++){const r=this.methods[o];if(!(r.target instanceof Function)){const l=r.target;let c=l?.uuid;if(l&&(c=l.guid),c){const h=e[c];if(h){const d=(t=r.arguments)==null?void 0:t.map(u=>u instanceof Object&&u.uuid?e[u.uuid]:u!=null&&u.isComponent?e[u.guid]:u);s.push(new zn(h.clone,r.methodName,d,r.enabled))}else B()&&console.warn("Could not find target for event listener")}}}return new xe(s)}setEventTarget(e,t){if(this.key=e,this.target=t,this.key!==void 0){let s="",o=!1;for(const r of this.key)o&&fT(r)&&(s+="-"),o=!0,s+=r.toLowerCase();this.key=s}}get listenerCount(){var e;return((e=this.methods)==null?void 0:e.length)??0}get isInvoking(){return this._isInvoking}static from(...e){return new xe(e)}invoke(...e){var t;if(this._isInvoking)return console.warn("Circular event invocation detected. Please check your event listeners for circular references.",this),!1;if(((t=this.methods)==null?void 0:t.length)<=0)return!1;this._isInvoking=!0;try{this._methodsCopy.length=0,this._methodsCopy.push(...this.methods);for(const s of this._methodsCopy)s.invoke(...e);if(typeof this.target=="object"&&typeof this.key=="string"){const s=this.target.dispatchEvent;if(typeof s=="function"){const o=new Tu(this.key);o.args=e,s.call(this.target,o)}}}finally{this._isInvoking=!1,this._methodsCopy.length=0}return!0}addEventListener(e){return this.methods.push(new zn(e)),e}removeEventListener(e){if(e)for(let t=this.methods.length-1;t>=0;t--)this.methods[t].target===e&&(this.methods[t].enabled=!1,this.methods.splice(t,1))}removeAllEventListeners(){this.methods.length=0}}class yT extends es{constructor(){super([re,he],"ColorSerializer")}onDeserialize(e){if(e!=null)return e.a!==void 0?new he(e.r,e.g,e.b,e.a):e.alpha!==void 0?new he(e.r,e.g,e.b,e.alpha):new re(e.r,e.g,e.b)}onSerialize(e){if(e!=null)return e.a!==void 0?{r:e.r,g:e.g,b:e.b,a:e.a}:{r:e.r,g:e.g,b:e.b}}}const vT=new yT;class bT extends es{constructor(){super([Dt],"EulerSerializer")}onDeserialize(e,t){if(e!=null){if(e.order)return new Dt(e.x,e.y,e.z,e.order);if(e.x!=null)return new Dt(e.x,e.y,e.z)}}onSerialize(e,t){return{x:e.x,y:e.y,z:e.z,order:e.order}}}const _T=new bT;class wT extends es{constructor(){super(A,"ObjectSerializer")}onSerialize(e,t){if(t.objectToNode!==void 0&&e.uuid){const s=t.objectToNode[e.uuid];return wt&&console.log(s,e.name,e.uuid),{node:s}}}onDeserialize(e,t){var s,o,r;if(typeof e=="string"){if(e.endsWith(".glb")||e.endsWith(".gltf")){if(t.serializable instanceof Array&&t.serializable.includes(ce))return;B()&&be("Detected wrong usage of @serializable with Object3D or GameObject. Instead you should use AssetReference here! Please see the console for details.");const l=(o=(s=t.target)==null?void 0:s.constructor)==null?void 0:o.name;console.warn(`Wrong usage of @serializable detected in your script "${l}"
|
|
929
929
|
|
|
930
930
|
It looks like you used @serializable(Object3D) or @serializable(GameObject) for a prefab or scene reference which is exported to a separate glTF file.
|
|
931
931
|
|
|
@@ -937,7 +937,7 @@ ${t.path}! : AssetReference;
|
|
|
937
937
|
Could not find method ${d.method} on object ${p.name}. Please rename ${d.method} to ${y}?
|
|
938
938
|
`,p[y],`
|
|
939
939
|
in script: `,p),be("EventList methods must start with lowercase letter, see console for details");return}else console.warn(`EventList method:
|
|
940
|
-
Could not find method ${d.method} on object ${p.name}`,p,typeof p[d.method])};if(typeof p[d.method]!="function"){let y=!1,v=p;for(;v;){const b=Object.getOwnPropertyDescriptor(v,d.method);if(b&&(b.writable===!0||b.set)){y=!0;break}v=Object.getPrototypeOf(v)}!y&&(B()||wt)&&f()}}if(p){let f=d.argument;if(f!==void 0?f=u(f):d.arguments!==void 0&&(f=d.arguments.map(u)),!p[d.method])console.warn(`EventList method not found: "${d.method}" on ${p?.name}`);else{f!==void 0&&!Array.isArray(f)&&(f=[f]);const y=new zn(p,d.method,f,d.enabled);l.push(y)}}else B()&&console.warn("[Debug] EventList: Could not find event listener in scene",d,t.object,e)}const c=new xe(l);wt&&console.log(c);const h=t.target;return h!==void 0&&t.path!==void 0&&c.setEventTarget(t.path,h),c}}}const CT=new ST,Au=new WeakMap,PT=je.prototype.clone;je.prototype.clone=function(){const n=PT.call(this);return Au.has(n)||Au.set(n,this),n};class Cx extends es{constructor(){super([Ic,Vs])}onSerialize(e,t){}onDeserialize(e,t){if(e instanceof je&&t.type===Ic){let s=e;Au.has(s)&&(s=Au.get(s)),s.isRenderTargetTexture=!0,s.flipY=!0,s.offset.y=1,s.repeat.y=-1,s.needsUpdate=!0,s.mipmaps=[],s instanceof XC&&(s.isCompressedTexture=!1,s.format=yd);const o=new Ic(s.image.width,s.image.height,{colorSpace:On});return o.texture=s,o}}}new Cx;class Px extends es{constructor(){super([URL])}onSerialize(e,t){return null}onDeserialize(e,t){if(typeof e=="string"&&e.length>0)return vo(t.gltfId,e)}}new Px;var OT=Object.defineProperty,kT=(n,e,t,s)=>{for(var o=void 0,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=l(e,t,o)||o);return o&&OT(e,t,o),o};class Ka extends j{awake(){si.createIfNoneExists(this.context)}onEnable(){var e;(e=si.get(this.context))==null||e.register(this)}onDisable(){var e;(e=si.get(this.context))==null||e.unregister(this)}}class ji extends Ka{constructor(){super(...arguments),a(this,"targets",null),a(this,"raycastHits",[]),a(this,"ignoreSkinnedMeshes",!1)}start(){this.targets=[this.gameObject]}performRaycast(e=null){if(!this.targets)return null;e??(e=new Dn),e.targets=this.targets,e.results=this.raycastHits,e.useAcceleratedRaycast=!0;const t=e.testObject;this.ignoreSkinnedMeshes&&(e.testObject=o=>o instanceof Pn?"continue in children":t?t(o):!0);const s=this.context.physics.raycast(e);return e.testObject=t,s}}kT([m()],ji.prototype,"ignoreSkinnedMeshes");class Iu extends ji{constructor(){super(),this.ignoreSkinnedMeshes=!0}}const Ox=class yC extends Ka{performRaycast(e){if(!oe.active||!yC.allow||!(e!=null&&e.ray))return null;const t=e.ray.origin;return this.context.physics.sphereOverlap(t,.015,!1,!0)}};a(Ox,"allow",!0);let Bc=Ox;class Wf{static getObject(e){const t=e[Ri];return t&&(t.isComponent===!0?e=t.gameObject:e=t),e}static isInteractable(e,t){if(t&&(t.canvasGroup=void 0,t.graphic=void 0),e==null||!e.visible||(e=this.getObject(e),!e.visible))return!1;const s=this.tryFindCanvasGroup(e);if(s?.isCanvasGroup===!0&&(t&&(t.canvasGroup=s),s.blocksRaycasts===!1||s.interactable===!1))return!1;const o=Er(e,r=>{if(r.isGraphic===!0)return r},!1);return t&&o?.isGraphic===!0&&(t.graphic=o),!(o?.raycastTarget===!1||o?.layer===2)}static tryFindCanvasGroup(e){if(!e)return null;const t=Er(e,s=>{const o=s;if(o.blocksRaycasts!==void 0&&o.interactable!==void 0)return o},!1);return t!==void 0?t:this.tryFindCanvasGroup(e.parent)}}function Vf(n){return n[Ri]||(n.parent?Vf(n.parent):null)}function MT(n){return n.isUI===!0||typeof n[Ri]=="object"}function Lu(n,e){if(!n)return;const t=n.material;if(t?.isMaterial===!0){const s=n.parent;s&&s.isText,t.side=e.doubleSided??!0?Oi:yo,t.shadowSide=e.doubleSided?Oi:yo,n.castShadow=e.castShadows?e.castShadows:!1,n.receiveShadow=e.receiveShadows?e.receiveShadows:!1}for(const s of n.children)Lu(s,e)}function Za(n,e,t){n[e]===void 0&&console.warn("Field",e,"is undefined on",n);const s=Proxy.revocable(n[e],{set(l,c,h,d){const u=l[c],p=Reflect.set(l,c,h,d);return t(h,u),p}}),o=s.revoke,r=n[e];return s.revoke=()=>{n[e]=r,o()},n[e]=s.proxy,s}const kx=Symbol("Scheduled action");function RT(n,e,t=Oe.OnBeforeRender){let s=n[kx];s||(s=n[kx]={});const o=e.name;s[t]||(s[t]={});const r=s[t];if(r[o])return;function*l(){e?.call(n),r[o]=null}const c=n.startCoroutine(l(),t);r[o]=c}const Eo=C("debugeventsystem");var $f=(n=>(n.BeforeHandleInput="BeforeHandleInput",n.AfterHandleInput="AfterHandleInput",n))($f||{});nx(n=>{si.createIfNoneExists(n)});class si extends j{constructor(){super(...arguments),a(this,"raycaster",[]),a(this,"pressedByID",new Map),a(this,"hoveredByID",new Map),a(this,"onPointerEvent",e=>{if(e===void 0||e.propagationStopped||e.defaultPrevented||e.used)return;const t=new hd(this.context.input,e);this._currentPointerEventName=e.type,t.inputSource=this.context.input,t.isClick=e.isClick,t.isDoubleClick=e.isDoubleClick,t.isDown=e.type==Be.PointerDown,t.isUp=e.type==Be.PointerUp,t.isPressed=this.context.input.getPointerPressed(e.pointerId);const s=new Dn;e.hasRay?s.ray=e.ray:s.screenPoint=this.context.input.getPointerPositionRC(e.pointerId),s.allowSlowRaycastFallback=e.isClick||e.isDoubleClick;const o=this.performRaycast(s);if(Eo&&(t.isDown?console.log("DOWN",{id:t.pointerId,hits:o.length}):t.isUp&&console.log("UP",{id:t.pointerId,hits:o.length}),t.isClick&&console.log("CLICK",{id:t.pointerId,hits:o.length})),o){for(const l of o)l.event=e,e.intersections.push(l);e.origin.onPointerHits&&e.origin.onPointerHits({sender:this,event:e,hits:o})}Eo&&t.isClick&&De("EventSystem: "+t.pointerId+" - "+this.context.time.frame+" - Up:"+t.isUp+", Down:"+t.isDown);const r={sender:this,args:t,hasActiveUI:this.currentActiveMeshUIComponents.length>0};this.dispatchEvent(new CustomEvent("BeforeHandleInput",{detail:r})),this.handleIntersections(o,t),this.dispatchEvent(new CustomEvent("AfterHandleInput",{detail:r}))}),a(this,"_sortedHits",[]),a(this,"_testObjectsCache",new Map),a(this,"_currentlyActiveRaycaster",null),a(this,"_currentPointerEventName",null),a(this,"shouldRaycastObject",e=>{var t;const s=e&&"getComponent"in e?e.getComponent(Ka):null;if(s&&s!=this._currentlyActiveRaycaster)return!1;let o=null;if(MT(e)&&(o=(t=e[Ri])==null?void 0:t.gameObject),this._testObjectsCache.has(e)||o&&this._testObjectsCache.has(o))return this._testObjectsCache.get(e)===!1?"continue in children":!0;{let r=Ru(e,this._currentPointerEventName);if(!r&&o&&(r=Ru(o,this._currentPointerEventName)),r){this._testObjectsCache.set(e,!0);for(const l of e.children)this.shouldRaycastObject_AddToYesCache(l);return!0}return this._testObjectsCache.set(e,!1),"continue in children"}}),a(this,"_sortingBuffer",[]),a(this,"_noDepthTestingResults",[]),a(this,"out",{}),a(this,"_capturedPointer",{}),a(this,"pointerEnterSymbol",Symbol("pointerEnter")),a(this,"pointerExitSymbol",Symbol("pointerExit")),a(this,"currentActiveMeshUIComponents",[])}static ensureUpdateMeshUI(e,t,s=!1){Ao.update(e,t,s)}static markUIDirty(e){Ao.markDirty()}static createIfNoneExists(e){e.scene.getComponent(si)||e.scene.addComponent(si)}static get(e){return this.createIfNoneExists(e),e.scene.getComponent(si)}static get instance(){return this.get(J.Current)}register(e){var t;e&&this.raycaster&&!this.raycaster.includes(e)&&((t=this.raycaster)==null||t.push(e))}unregister(e){var t,s;const o=(t=this.raycaster)==null?void 0:t.indexOf(e);o!==void 0&&o!==-1&&((s=this.raycaster)==null||s.splice(o,1))}get hasActiveUI(){return this.currentActiveMeshUIComponents.length>0}get isHoveringObjects(){return this.hoveredByID.size>0}awake(){this.gameObject!==this.context.scene&&(console.debug(`[Needle Engine] EventSystem is only allowed on the scene root. Disabling EventSystem on '${this.gameObject.name}'`),this.enabled=!1)}start(){this.context.scene.getComponent(Ka)||this.context.scene.addComponent(ji)}onEnable(){this.context.input.addEventListener(Be.PointerDown,this.onPointerEvent),this.context.input.addEventListener(Be.PointerUp,this.onPointerEvent),this.context.input.addEventListener(Be.PointerMove,this.onPointerEvent)}onDisable(){this.context.input.removeEventListener(Be.PointerDown,this.onPointerEvent),this.context.input.removeEventListener(Be.PointerUp,this.onPointerEvent),this.context.input.removeEventListener(Be.PointerMove,this.onPointerEvent)}onBeforeRender(){this.resetMeshUIStates()}shouldRaycastObject_AddToYesCache(e){this._testObjectsCache.set(e,!0);for(const t of e.children)this.shouldRaycastObject_AddToYesCache(t)}performRaycast(e){if(!this.raycaster)return null;this._testObjectsCache.clear(),this._sortedHits.length=0,e.testObject=this.shouldRaycastObject;for(const t of this.raycaster){if(!t.activeAndEnabled)continue;this._currentlyActiveRaycaster=t;const s=t.performRaycast(e);this._currentlyActiveRaycaster=null,s&&s.length>0&&this._sortedHits.push(...s)}return this._sortedHits.sort((t,s)=>t.distance-s.distance),this._sortedHits}assignHitInformation(e,t){t?(e.intersection=t,e.point=t.point,e.normal=t.normal,e.face=t.face,e.distance=t.distance,e.instanceId=t.instanceId):(e.intersection=void 0,e.point=void 0,e.normal=void 0,e.face=void 0,e.distance=void 0,e.instanceId=void 0)}handleIntersections(e,t){var s;if(e!=null&&e.length){e=this.sortCandidates(e);for(const r of e){if(t.event.immediatePropagationStopped)return!1;if(this.assignHitInformation(t,r),this.handleEventOnObject(r.object,t))return!0}}this.assignHitInformation(t,e?.[0]),this.invokePointerCapture(t);const o=this.hoveredByID.get(t.pointerId);return o&&this.propagatePointerExit(o.obj,o.data,null),this.hoveredByID.delete(t.pointerId),t.isUp&&((s=this.pressedByID.get(t.pointerId))==null||s.handlers.forEach(r=>this.invokeOnPointerUp(t,r)),this.pressedByID.delete(t.pointerId)),!1}sortCandidates(e){this._sortingBuffer.length=0,this._noDepthTestingResults.length=0;for(let t=0;t<e.length;t++){const s=e[t],o=s.object;if(o.material&&o.material.depthTest===!1){this._noDepthTestingResults.push(s);continue}this._sortingBuffer.push(s)}for(const t of this._sortingBuffer)this._noDepthTestingResults.push(t);return this._noDepthTestingResults}handleEventOnObject(e,t){if(!this.testIsVisible(e))return t.isClick&&Eo&&console.log("not allowed",e),!1;if(t.pointerId===void 0)return Eo&&console.error("Event without pointer can't be handled",t),!1;t.object=e;const s=e.parent,o=t.isClick??!1;let r=null;if(s&&s.isUI){const d=(t.isPressed||t.isClick)??!1;if(s[Ri]){const u=s[Ri].gameObject;if(u){if(!Wf.isInteractable(u,this.out))return!1;r=this.out.canvasGroup??null,this.handleMeshUIIntersection(e,d),e=u}}}o&&Eo&&console.log(this.context.time.frame,e);const l=this.hoveredByID.get(t.pointerId),c=l?.obj;c!==e&&c&&this.propagatePointerExit(c,l.data,e);const h=this.hoveredByID.get(t.pointerId);if(h?(h.obj=e,h.data=t):this.hoveredByID.set(t.pointerId,{obj:e,data:t}),t.isDown){const d=this.pressedByID.get(t.pointerId);d?(d.obj=e,d.data=t):this.pressedByID.set(t.pointerId,{obj:e,data:t,handlers:new Set})}return(r===null||r.interactable)&&this.handleMainInteraction(e,t,c??null),!0}propagate(e,t){for(;e;)P.foreachComponent(e,s=>{t(s)},!1),e=e.parent}handleMainInteraction(e,t,s){const o=this.pressedByID.get(t.pointerId),r=s!==e;let l=!0;switch(t.event.pointerType){case"mouse":case"touch":const c=this.context.input.getPointerPositionLastFrame(t.pointerId),h=this.context.input.getPointerPosition(t.pointerId);l=c&&!W.approximately(c,h);break}this.propagate(e,c=>{var h;const d=c;d.interactable!==!1&&(!d.activeAndEnabled||!d.enabled||(d.onPointerEnter&&r&&this.handlePointerEnter(d,t),t.isDown&&d.onPointerDown&&(d.onPointerDown(t),o?.handlers.add(d),this.handlePointerCapture(t,d)),d.onPointerMove&&(l&&d.onPointerMove(t),this.handlePointerCapture(t,d)),t.isUp&&(d.onPointerUp&&(this.invokeOnPointerUp(t,d),o?.handlers.delete(d)),d.onPointerExit&&((h=t.event)==null?void 0:h.pointerType)===zd.Touch&&(this.handlePointerExit(d,t),this.hoveredByID.delete(t.pointerId))),t.isClick&&d.onPointerClick&&d.onPointerClick(t)))}),t.isUp&&(o?.handlers.forEach(c=>{this.invokeOnPointerUp(t,c)}),this.pressedByID.delete(t.pointerId))}propagatePointerExit(e,t,s){this.propagate(e,o=>{if(!o.gameObject||o.destroyed)return;const r=o;if(r.onPointerExit||r.onPointerEnter){if(s&&this.isChild(s,o.gameObject))return;this.handlePointerExit(r,t)}})}invokeOnPointerUp(e,t){var s;(s=t.onPointerUp)==null||s.call(t,e),this.releasePointerCapture(e,t)}handlePointerEnter(e,t){e.onPointerEnter&&this.updatePointerState(e,t.pointerId,this.pointerEnterSymbol,!0)&&e.onPointerEnter(t),this.updatePointerState(e,t.pointerId,this.pointerExitSymbol,!1)}handlePointerExit(e,t){e.onPointerExit&&this.updatePointerState(e,t.pointerId,this.pointerExitSymbol,!0)&&e.onPointerExit(t),this.updatePointerState(e,t.pointerId,this.pointerEnterSymbol,!1)}updatePointerState(e,t,s,o){let r=e[s];if(o)return r&&r.includes(t)?!1:(r=r||[],r.push(t),e[s]=r,!0);{if(!r||!r.includes(t))return!1;const l=r.indexOf(t);return l!==-1&&r.splice(l,1),!0}}handlePointerCapture(e,t){if(e.z__pointer_ctured){e.z__pointer_ctured=!1;const s=e.pointerId;if(t.onPointerMove){const o=this._capturedPointer[s]||[];o.push(t),this._capturedPointer[s]=o}else B()&&!t.z__warned_no_pointermove&&(t.z__warned_no_pointermove=!0,console.warn("PointerCapture was requested but the component doesn't implement onPointerMove. It will not receive any pointer events"))}else e.z__pointer_cture_rleased&&(e.z__pointer_cture_rleased=!1,this.releasePointerCapture(e,t))}releasePointerCapture(e,t){const s=e.pointerId;if(this._capturedPointer[s]){const o=this._capturedPointer[s].indexOf(t);o!==-1&&(this._capturedPointer[s].splice(o,1),Eo&&console.log("released pointer capture",s,t,this._capturedPointer))}}invokePointerCapture(e){var t;if(e.event.type===Be.PointerMove){const s=e.pointerId,o=this._capturedPointer[s];if(o){Eo&&console.log("Captured",s,o);for(let r=0;r<o.length;r++){const l=o[r];if(l.destroyed){o.splice(r,1),r--;continue}(t=l.onPointerMove)==null||t.call(l,e)}}}}isChild(e,t){return!e||!t?!1:e===t?!0:e.parent?this.isChild(e.parent,t):!1}handleMeshUiObjectWithoutShadowDom(e,t){return!e||!e.isUI?!0:this.handleMeshUIIntersection(e,t)}handleMeshUIIntersection(e,t){const s=Ao.updateState(e,t);return s&&this.currentActiveMeshUIComponents.push(s),s!==null}resetMeshUIStates(){if(this.context.input.getPointerPressedCount()>0&&Ao.resetLastSelected(),!(!this.currentActiveMeshUIComponents||this.currentActiveMeshUIComponents.length<=0)){for(let e=0;e<this.currentActiveMeshUIComponents.length;e++){const t=this.currentActiveMeshUIComponents[e];Ao.resetState(t)}this.currentActiveMeshUIComponents.length=0}}testIsVisible(e){return e?P.isActiveSelf(e)?this.testIsVisible(e.parent):!1:!0}}class Ao{static markDirty(){this.needsUpdate=!0}static update(e,t,s=!1){if(s){e.update();return}const o=t.time.frameCount;for(const r of this.lastUpdateFrame)if(r.context===t){if(o===r.frame)return;r.frame=o;let l=this.needsUpdate||o<1;r.nextUpdate<=o&&(l=!0),l&&(Eo&&console.log("Update threemeshui"),this.needsUpdate=!1,r.nextUpdate=o+60,e.update());return}this.lastUpdateFrame=[{context:t,frame:o,nextUpdate:o+60}],e.update(),this.needsUpdate=!1}static updateState(e,t){let s=null;if(e&&(s=this.findBlockOrTextInParent(e),s&&s!==this.lastSelected)){if(s.interactable===!1)return null;this.needsUpdate=!0}return s}static resetLastSelected(){const e=this.lastSelected;e&&(this.lastSelected=null,this.resetState(e))}static resetState(e){e&&(this.needsUpdate=!0)}static findBlockOrTextInParent(e){return e?e.isBlock||e.isText?e:this.findBlockOrTextInParent(e.parent):null}}a(Ao,"lastSelected",null),a(Ao,"lastUpdateFrame",[]),a(Ao,"needsUpdate",!1);var TT=Object.defineProperty,Ue=(n,e,t,s)=>{for(var o=void 0,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=l(e,t,o)||o);return o&&TT(e,t,o),o};const is=C("debugorbit"),Hf=C("freecam"),Fc=C("debugcamerafit"),ju=C("smoothcam"),ET={LEFT:"",UP:"",RIGHT:"",BOTTOM:""};let Gf;class Uc extends CustomEvent{constructor(e,t){super("target-reached",{detail:{controls:e,type:t}})}}class _e extends j{constructor(){super(...arguments),a(this,"autoTarget",!0),a(this,"autoFit",!1),a(this,"enableRotate",!0),a(this,"autoRotate",!1),a(this,"autoRotateSpeed",1),a(this,"minAzimuthAngle",1/0),a(this,"maxAzimuthAngle",1/0),a(this,"minPolarAngle",0),a(this,"maxPolarAngle",Math.PI),a(this,"enableKeys",!1),a(this,"enableDamping",!0),a(this,"dampingFactor",.1),a(this,"enableZoom",!0),a(this,"minZoom",0),a(this,"maxZoom",1/0),a(this,"zoomSpeed",1),a(this,"zoomToCursor",!1),a(this,"enablePan",!0),a(this,"lookAtConstraint",null),a(this,"lookAtConstraint01",1),a(this,"allowInterrupt",!0),a(this,"middleClickToFocus",!0),a(this,"doubleClickToFocus",!0),a(this,"clickBackgroundToFitScene",2),a(this,"debugLog",!1),a(this,"targetLerpDuration",1),a(this,"_controls",null),a(this,"_cameraObject",null),a(this,"_lookTargetLerpActive",!1),a(this,"_lookTargetStartPosition",new S),a(this,"_lookTargetEndPosition",new S),a(this,"_lookTargetLerp01",0),a(this,"_lookTargetLerpDuration",0),a(this,"_cameraLerpActive",!1),a(this,"_cameraStartPosition",new S),a(this,"_cameraEndPosition",new S),a(this,"_cameraLerp01",0),a(this,"_cameraLerpDuration",0),a(this,"_fovLerpActive",!1),a(this,"_fovLerpStartValue",0),a(this,"_fovLerpEndValue",0),a(this,"_fovLerp01",0),a(this,"_fovLerpDuration",0),a(this,"_inputs",0),a(this,"_enableTime",0),a(this,"_startedListeningToKeyEvents",!1),a(this,"_eventSystem"),a(this,"_afterHandleInputFn"),a(this,"_camera",null),a(this,"_syncedTransform"),a(this,"_didSetTarget",0),a(this,"targetElement",null),a(this,"_activePointerEvents"),a(this,"_lastTimeClickOnBackground",-1),a(this,"_clickOnBackgroundCount",0),a(this,"_onPointerDown",e=>{this._activePointerEvents.push(e)}),a(this,"_onPointerDownLate",e=>{e.used&&this._controls&&(this._controls.enabled=!1)}),a(this,"_onPointerUp",e=>{for(let t=this._activePointerEvents.length-1;t>=0;t--){const s=this._activePointerEvents[t];if(s.pointerId===e.pointerId&&s.button===e.button){this._activePointerEvents.splice(t,1);break}}if(this.clickBackgroundToFitScene>0&&e.isClick&&e.button===0){if(e.hasRay||e.intersections.push(...this.context.physics.raycast()),e.intersections.length<=0){const t=this.context.time.time-this._lastTimeClickOnBackground;this._lastTimeClickOnBackground=this.context.time.time,this.clickBackgroundToFitScene<=1||t<this.clickBackgroundToFitScene*.15?(this._clickOnBackgroundCount+=1,this._clickOnBackgroundCount>=this.clickBackgroundToFitScene-1&&this.fitCamera(this.context.scene.children,{immediate:!1})):this._clickOnBackgroundCount=0}is&&console.log(this.clickBackgroundToFitScene,e.intersections.length,this._clickOnBackgroundCount)}}),a(this,"_onPointerUpLate",e=>{this.doubleClickToFocus&&e.isDoubleClick&&!e.used&&this.setTargetFromRaycast()}),a(this,"_orbitStartAngle",0),a(this,"_zoomStartDistance",0),a(this,"onControlsChangeStarted",()=>{this._controls&&(this._orbitStartAngle=this._controls.getAzimuthalAngle()+this._controls.getPolarAngle(),this._zoomStartDistance=this._controls.getDistance()),this._syncedTransform&&this._syncedTransform.requestOwnership()}),a(this,"onControlsChangeEnded",()=>{if(this._controls&&this.autoTarget){const e=this._controls.getAzimuthalAngle()+this._controls.getPolarAngle()-this._orbitStartAngle;Math.abs(e)<.01?(is&&console.debug("OrbitControls: Update target",{deltaAngle:e}),this.updateTargetNow({allowSlowRaycastFallback:!1})):is&&console.debug("OrbitControls: No target update",{deltaAngle:e})}}),a(this,"_shouldDisable",!1),a(this,"__onPreRender",()=>{const e=this.context.pre_render_callbacks.indexOf(this.__onPreRender);e>=0&&this.context.pre_render_callbacks.splice(e,1),this.autoFit&&(this.autoFit=!1,this.fitCamera({centerCamera:"y",immediate:!0,objects:this.scene.children}))}),a(this,"_haveAttachedKeyboardEvents",!1)}get isCameraController(){return!0}get controls(){return this._controls}get controllerObject(){return this._cameraObject}onStartInteraction(e){var t;(t=this.controls)==null||t.addEventListener("start",e)}get targetLerpSpeed(){return 5}set targetLerpSpeed(e){this.targetLerpDuration=1/e}rotateLeft(e){var t;(t=this._controls)==null||t._rotateLeft(e)}pan(e,t){var s;(s=this._controls)==null||s._pan(e,t)}zoomIn(e){var t,s;e>0?(t=this._controls)==null||t._dollyIn(1-e):e<0&&((s=this._controls)==null||s._dollyOut(1+e))}awake(){is&&console.debug("OrbitControls",this),this._didSetTarget=0,this._startedListeningToKeyEvents=!1}start(){this._eventSystem=si.get(this.context)??void 0,this._eventSystem&&(this._afterHandleInputFn=this.afterHandleInput.bind(this),this._eventSystem.addEventListener($f.AfterHandleInput,this._afterHandleInputFn))}onDestroy(){var e,t;(e=this._controls)==null||e.dispose(),(t=this._eventSystem)==null||t.removeEventListener($f.AfterHandleInput,this._afterHandleInputFn)}onEnable(){this._didSetTarget=0,this._enableTime=this.context.time.time;const e=P.getComponent(this.gameObject,hi);this._camera=e;let t=e?.threeCamera;if(!t&&this.gameObject instanceof we&&(t=this.gameObject),t&&ag(t,this,!0),!this._controls&&t instanceof A){this._cameraObject=t;const s=this.targetElement??this.context.renderer.domElement,o=t?.quaternion.clone();this._controls=new Gv(t,s),t?.quaternion.copy(o),Gf===void 0&&(Gf={...this._controls.keys});const r=ee(t),l=this.gameObject.worldForward,c=r.clone().sub(l.multiplyScalar(2.5));this._controls.target.copy(c)}if(this._controls)if(Hf&&(this.enablePan=!0,this.enableZoom=!0,this.middleClickToFocus=!0,Q.isMobileDevice()&&(this.doubleClickToFocus=!0)),this._controls.addEventListener("start",this.onControlsChangeStarted),this._controls.addEventListener("endMovement",this.onControlsChangeEnded),!this._startedListeningToKeyEvents&&this.enableKeys)this._startedListeningToKeyEvents=!0,this._controls.listenToKeyEvents(this.context.domElement);else try{this._controls.stopListenToKeyEvents()}catch{}this._syncedTransform=P.getComponent(this.gameObject,sn)??void 0,this.context.pre_render_callbacks.push(this.__onPreRender),this._activePointerEvents=[],this.context.input.addEventListener("pointerdown",this._onPointerDown,{queue:ri.Early}),this.context.input.addEventListener("pointerdown",this._onPointerDownLate,{queue:ri.Late}),this.context.input.addEventListener("pointerup",this._onPointerUp,{queue:ri.Early}),this.context.input.addEventListener("pointerup",this._onPointerUpLate,{queue:ri.Late})}onDisable(){var e;if((e=this._camera)!=null&&e.threeCamera&&ag(this._camera.threeCamera,this,!1),this._controls){this._controls.enabled=!1,this._controls.autoRotate=!1,this._controls.removeEventListener("start",this.onControlsChangeStarted),this._controls.removeEventListener("endMovement",this.onControlsChangeEnded);try{this._controls.stopListenToKeyEvents()}catch{}this._startedListeningToKeyEvents=!1}this._activePointerEvents.length=0,this.context.input.removeEventListener("pointerdown",this._onPointerDown),this.context.input.removeEventListener("pointerdown",this._onPointerDownLate),this.context.input.removeEventListener("pointerup",this._onPointerUp),this.context.input.removeEventListener("pointerup",this._onPointerUpLate)}updateTargetNow(e){var t,s,o;const r=new mo((t=this._cameraObject)==null?void 0:t.worldPosition,(s=this._cameraObject)==null?void 0:s.worldForward.multiplyScalar(-1)),l=this.context.physics.raycastFromRay(r,e),c=l.length>0?l[0]:void 0;c&&c.distance>this.minZoom&&c.distance<this.maxZoom&&(is&&G.DrawWireSphere(c.point,.1,16711680,2),(o=this._controls)==null||o.target.copy(l[0].point))}afterHandleInput(e){e.detail.args.pointerId===0&&(e.detail.args.isDown?this._controls&&this._eventSystem&&(this._shouldDisable=this._eventSystem.hasActiveUI):(!e.detail.args.isPressed||e.detail.args.isUp)&&(this._shouldDisable=!1))}onBeforeRender(){var e,t,s,o;if(!!this._controls){if(this._cameraObject!==this.context.mainCamera){this._controls.enabled=!1;return}if(this._controls.enabled=!0,(this.context.input.getPointerDown(1)||this.context.input.getPointerDown(2)||this.context.input.mouseWheelChanged||this.context.input.getPointerPressed(0)&&(e=this.context.input.getPointerPositionDelta(0))!=null&&e.length())&&(this._inputs+=1),this._inputs>0&&this.allowInterrupt&&(this.enableRotate&&(this.autoRotate=!1),this._cameraLerpActive=!1,this._lookTargetLerpActive=!1),this._inputs=0,this.autoTarget&&this._didSetTarget++===0){const r=P.getComponent(this.gameObject,hi);if(r&&!this.setLookTargetFromConstraint()){this.debugLog&&console.log("NO TARGET");const l=ee(r.threeCamera),c=Math.max(.01,l.length()),h=new S(0,0,-c).applyMatrix4(r.threeCamera.matrixWorld);is&&G.DrawLine(l,h,5592575,10),this.setLookTargetPosition(h,!0)}if(!this.setLookTargetFromConstraint()){const l=new Dn;l.screenPoint=new ie(0,0),l.lineThreshold=.1;const c=this.context.physics.raycast(l);c.length>0&&this.setLookTargetPosition(c[0].point,!0),Fc&&console.log("OrbitControls hits",...c)}}if(this.middleClickToFocus&&this.context.input.getPointerClicked(1)&&this.setTargetFromRaycast(),this._lookTargetLerpActive||this._cameraLerpActive||this._fovLerpActive){if(this._cameraLerpActive&&this._cameraObject)if(this._cameraLerp01+=this.context.time.deltaTime/this._cameraLerpDuration,this._cameraLerp01>=1)this._cameraObject.position.copy(this._cameraEndPosition),this._cameraLerpActive=!1,this.dispatchEvent(new Uc(this,"camera"));else{const r=W.easeInOutCubic(this._cameraLerp01);this._cameraObject.position.lerpVectors(this._cameraStartPosition,this._cameraEndPosition,r)}if(this._lookTargetLerpActive)if(this._lookTargetLerp01+=this.context.time.deltaTime/this._lookTargetLerpDuration,this._lookTargetLerp01>=1)this._controls.target.copy(this._lookTargetEndPosition),this._lookTargetLerpActive=!1,this.dispatchEvent(new Uc(this,"lookat"));else{const r=W.easeInOutCubic(this._lookTargetLerp01);this._controls.target.lerpVectors(this._lookTargetStartPosition,this._lookTargetEndPosition,r)}if(this._fovLerpActive&&this._cameraObject){const r=this._cameraObject;if(this._fovLerp01+=this.context.time.deltaTime/this._fovLerpDuration,this._fovLerp01>=1)r.fov=this._fovLerpEndValue,this._fovLerpActive=!1;else{const l=W.easeInOutCubic(this._fovLerp01);r.fov=W.lerp(this._fovLerpStartValue,this._fovLerpEndValue,l)}r.updateProjectionMatrix()}}if(this._controls){if(this.debugLog&&(this._controls.domElement=this.context.renderer.domElement),this._controls.enabled=!this._shouldDisable&&this._camera===this.context.mainCameraComponent&&!this.context.isInXR&&!this._activePointerEvents.some(r=>r.used),this._controls.keys=this.enableKeys?Gf:ET,this._controls.autoRotate=this.autoRotate,this._controls.autoRotateSpeed=this.autoRotateSpeed,this._controls.enableZoom=this.enableZoom,this._controls.zoomSpeed=this.zoomSpeed,this._controls.zoomToCursor=this.zoomToCursor,this._controls.enableDamping=this.enableDamping,this._controls.dampingFactor=this.dampingFactor,this._controls.enablePan=this.enablePan,this._controls.enableRotate=this.enableRotate,this._controls.minAzimuthAngle=this.minAzimuthAngle,this._controls.maxAzimuthAngle=this.maxAzimuthAngle,this._controls.minPolarAngle=this.minPolarAngle,this._controls.maxPolarAngle=this.maxPolarAngle,Hf||(((s=(t=this._camera)==null?void 0:t.threeCamera)==null?void 0:s.type)==="PerspectiveCamera"?(this._controls.minDistance=this.minZoom,this._controls.maxDistance=this.maxZoom,this._controls.minZoom=0,this._controls.maxZoom=1/0):(this._controls.minDistance=0,this._controls.maxDistance=1/0,this._controls.minZoom=this.minZoom,this._controls.maxZoom=this.maxZoom)),typeof ju=="number"||ju===!0){this._controls.enableDamping=!0;const r=typeof ju=="number"?ju:.99;this._controls.dampingFactor=Math.max(.001,1-Math.min(1,r))}this.allowInterrupt||(this._lookTargetLerpActive&&(this._controls.enablePan=!1),this._cameraLerpActive&&(this._controls.enableRotate=!1,this._controls.autoRotate=!1),(this._lookTargetLerpActive||this._cameraLerpActive)&&(this._controls.enableZoom=!1)),this.context.isInXR||(!Hf&&(o=this.lookAtConstraint)!=null&&o.locked&&this.setLookTargetFromConstraint(0,this.lookAtConstraint01),this._controls.update(this.context.time.deltaTime),is&&G.DrawWireSphere(this._controls.target,.1,65280))}}}setCameraAndLookTarget(e,t=!1){if(!e)return(B()||is)&&console.warn("[OrbitControls] setCameraAndLookTarget target is null"),!1;if(!(e instanceof A)&&!(e instanceof hi))return(B()||is)&&console.warn("[OrbitControls] setCameraAndLookTarget target is not an Object3D or Camera"),!1;e instanceof hi&&(e=e.gameObject);const s=e.worldPosition,o=e.worldForward;e instanceof QC&&(is&&console.debug("[OrbitControls] setCameraAndLookTarget flip forward direction for camera"),o.multiplyScalar(-1));const r=new mo(s,o);return is&&G.DrawRay(r.origin,r.direction,16711680,10),this.setTargetFromRaycast(r,t)||this.setLookTargetPosition(r.at(2,X()),t),this.setCameraTargetPosition(s,t),!0}setCameraTargetPosition(e,t=!1){var s;e&&(e instanceof A&&(e=ee(e)),this._cameraEndPosition||(this._cameraEndPosition=new S),this._cameraEndPosition.copy(e),t===!0?(this._cameraLerpActive=!1,this._cameraObject&&this._cameraObject.position.copy(this._cameraEndPosition)):this._cameraObject&&(this._cameraLerpActive=!0,this._cameraLerp01=0,this._cameraStartPosition.copy((s=this._cameraObject)==null?void 0:s.position),typeof t=="number"?this._cameraLerpDuration=t:this._cameraLerpDuration=this.targetLerpDuration))}get cameraLerpActive(){return this._cameraLerpActive}stopCameraLerp(){this._cameraLerpActive=!1}setFieldOfView(e,t=!1){var s;if(!this._controls||typeof e!="number")return;const o=(s=this._camera)==null?void 0:s.threeCamera;o&&(t===!0?o.fov=e:(this._fovLerpActive=!0,this._fovLerp01=0,this._fovLerpStartValue=o.fov,this._fovLerpEndValue=e,typeof t=="number"?this._fovLerpDuration=t:this._fovLerpDuration=this.targetLerpDuration))}setLookTargetPosition(e=null,t=!1){this._controls&&e&&(e instanceof A&&(e=ee(e)),this._lookTargetEndPosition.copy(e),this._didSetTarget++,is&&(console.warn("OrbitControls: setLookTargetPosition",e,t),G.DrawWireSphere(this._lookTargetEndPosition,.2,16711680,2)),t===!0?this._controls.target.copy(this._lookTargetEndPosition):(this._lookTargetLerpActive=!0,this._lookTargetLerp01=0,this._lookTargetStartPosition.copy(this._controls.target),typeof t=="number"?this._lookTargetLerpDuration=t:this._lookTargetLerpDuration=this.targetLerpDuration))}get lookTargetLerpActive(){return this._lookTargetLerpActive}stopLookTargetLerp(){this._lookTargetLerpActive=!1}setLookTargetFromConstraint(e=0,t=1){var s,o;if(!this._controls||((s=this.lookAtConstraint)==null?void 0:s.enabled)===!1)return!1;const r=(o=this.lookAtConstraint)==null?void 0:o.sources;if(r&&r.length>0){const l=r[e];if(l)return l.getWorldPosition(this._lookTargetEndPosition),this.lerpLookTarget(this._lookTargetEndPosition,t),!0}return!1}lerpTarget(e,t){return this.lerpLookTarget(e,t)}lerpLookTarget(e,t){this._controls&&(t>=1?this._controls.target.copy(e):this._controls.target.lerp(e,t))}setTargetFromRaycast(e,t=!1){if(!this.controls)return!1;const s=e?this.context.physics.raycastFromRay(e):this.context.physics.raycast();for(const o of s)if(o.distance>0&&P.isActiveInHierarchy(o.object)){const r=Vf(o.object);if(r){const l=r.canvas;if(l!=null&&l.screenspace)break}return this.setLookTargetPosition(o.point,t),!0}return!1}fitCamera(e,t){var s,o;if(this.context.isInXR)return;let r;if(Array.isArray(e)?r=e:e&&"type"in e?r=e.children:e&&typeof e=="object"&&!(e instanceof A)&&!Array.isArray(e)&&(t=e,r=t.objects),r&&!Array.isArray(r)&&(r=r.children),(!Array.isArray(r)||r&&r.length<=0)&&(r=this.context.scene.children),!Array.isArray(r)||r.length<=0){console.warn("No objects to fit camera to...");return}const l=this._cameraObject,c=this._controls;if(!l||!c){console.warn("No camera or controls found to fit camera to objects...");return}t||(t={});const{immediate:h=!1,centerCamera:d="y",cameraNearFar:u="auto",fitOffset:p=1.1,fov:g=l?.fov}=t,f=new S,y=new S,v=ni(r,void 0,(o=(s=this._camera)==null?void 0:s.threeCamera)==null?void 0:o.layers),b=v.clone();l.updateMatrixWorld(),l.updateProjectionMatrix(),v.getCenter(y);const _=new S;if(v.getSize(_),v.applyMatrix4(l.matrixWorldInverse),v.getSize(f),v.setFromCenterAndSize(y,f),Number.isNaN(f.x)||Number.isNaN(f.y)||Number.isNaN(f.z)){console.warn("Camera fit size resultet in NaN",l,v,[...r]);return}if(f.length()<=1e-10){Fc&&console.warn("Camera fit size is zero",v,[...r]);return}const w=t.fov||l.fov,x=2*Math.atan(Math.tan(w*Math.PI/360/2)*l.aspect)/Math.PI*360,k=f.y/(2*Math.atan(Math.PI*w/360)),M=f.x/(2*Math.atan(Math.PI*x/360)),T=p*Math.max(k,M)+f.z/2;Fc&&console.log("Fit camera to objects",{fitHeightDistance:k,fitWidthDistance:M,distance:T,verticalFov:w,horizontalFov:x}),this.maxZoom=T*10,this.minZoom=T*.01;const D=.05,z=y.clone();if(z.y-=f.y*D,this.setLookTargetPosition(z,h),this.setFieldOfView(t.fov,h),u==null||u=="auto"){const F=P.findObjectOfType(en),I=F?F.radius:0,Y=Math.max(_.x,_.y,_.z,I);l.near=T/100,l.far=Y+T*10,F&&(this.maxZoom=Math.max(Math.min(this.maxZoom,I*.5),T))}const U=c.getDistance();U<this.minZoom&&(this.minZoom=U*.9),U>this.maxZoom&&(this.maxZoom=U*1.1),l.updateMatrixWorld(),l.updateProjectionMatrix();const E=ee(l),$=y.clone();$.sub(E),d==="y"&&($.y=0),$.normalize(),$.multiplyScalar(T),d==="y"&&($.y+=-D*4*T);let H=y.clone().sub($);l.parent&&(H=l.parent.worldToLocal(H)),this.setCameraTargetPosition(H,h),(Fc||t.debug)&&(G.DrawWireBox3(v,16777011,10),G.DrawWireBox3(b,65280,10),!this._haveAttachedKeyboardEvents&&Fc&&(this._haveAttachedKeyboardEvents=!0,document.body.addEventListener("keydown",F=>{if(F.code==="KeyF"){let I;this._cameraObject instanceof we&&(I=Math.random()*Math.random()*170+10),this.fitCamera({objects:r,fitOffset:p,immediate:!1,fov:I})}F.code==="KeyV"&&this._cameraObject instanceof we&&(this._cameraObject.fov=60)}))),this.onBeforeRender()}}Ue([m()],_e.prototype,"autoTarget"),Ue([m()],_e.prototype,"autoFit"),Ue([m()],_e.prototype,"enableRotate"),Ue([m()],_e.prototype,"autoRotate"),Ue([m()],_e.prototype,"autoRotateSpeed"),Ue([m()],_e.prototype,"minAzimuthAngle"),Ue([m()],_e.prototype,"maxAzimuthAngle"),Ue([m()],_e.prototype,"minPolarAngle"),Ue([m()],_e.prototype,"maxPolarAngle"),Ue([m()],_e.prototype,"enableKeys"),Ue([m()],_e.prototype,"enableDamping"),Ue([m()],_e.prototype,"dampingFactor"),Ue([m()],_e.prototype,"enableZoom"),Ue([m()],_e.prototype,"minZoom"),Ue([m()],_e.prototype,"maxZoom"),Ue([m()],_e.prototype,"zoomSpeed"),Ue([m()],_e.prototype,"enablePan"),Ue([m(Br)],_e.prototype,"lookAtConstraint"),Ue([m()],_e.prototype,"lookAtConstraint01"),Ue([m()],_e.prototype,"allowInterrupt"),Ue([m()],_e.prototype,"middleClickToFocus"),Ue([m()],_e.prototype,"doubleClickToFocus"),Ue([m()],_e.prototype,"clickBackgroundToFitScene"),Ue([m()],_e.prototype,"targetLerpDuration");var AT=Object.defineProperty,IT=Object.getOwnPropertyDescriptor,Kt=(n,e,t,s)=>{for(var o=s>1?void 0:s?IT(e,t):e,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=(s?l(e,t,o):l(o))||o);return s&&o&&AT(e,t,o),o},Ur=(n=>(n[n.None=0]="None",n[n.Skybox=1]="Skybox",n[n.SolidColor=2]="SolidColor",n[n.Uninitialized=4]="Uninitialized",n))(Ur||{});const Io=C("debugcam"),Mx=C("debugscreenpointtoray");var Lo;const Ut=(Lo=class extends j{constructor(){super(...arguments),a(this,"_nearClipPlane",.1),a(this,"_farClipPlane",1e3),a(this,"orthographic",!1),a(this,"orthographicSize",5),a(this,"ARBackgroundAlpha",0),a(this,"_cullingMask",4294967295),a(this,"_backgroundBlurriness"),a(this,"_backgroundIntensity"),a(this,"_backgroundRotation"),a(this,"_environmentIntensity"),a(this,"_targetTexture",null),a(this,"_backgroundColor"),a(this,"_fov"),a(this,"_cam",null),a(this,"_clearFlags",2),a(this,"_skybox"),a(this,"_frustum"),a(this,"_projScreenMatrix",new ne)}get isCamera(){return!0}get aspect(){return this._cam instanceof we?this._cam.aspect:this.context.domWidth/this.context.domHeight}set aspect(n){this._cam instanceof we&&this._cam.aspect!==n&&(this._cam.aspect=n,this._cam.updateProjectionMatrix())}get fieldOfView(){return this._cam instanceof we?this._cam.fov:this._fov}set fieldOfView(n){const e=this.fieldOfView!=n;if(this._fov=n,e&&this._cam&&this._cam instanceof we){if(this._fov===void 0){console.warn("Can not set undefined fov on PerspectiveCamera");return}this._cam.fov=this._fov,this._cam.updateProjectionMatrix()}}get nearClipPlane(){return this._nearClipPlane}set nearClipPlane(n){const e=this._nearClipPlane!=n;this._nearClipPlane=n,this._cam&&(e||this._cam.near!=n)&&(this._cam.near=n,this._cam.updateProjectionMatrix())}get farClipPlane(){return this._farClipPlane}set farClipPlane(n){const e=this._farClipPlane!=n;this._farClipPlane=n,this._cam&&(e||this._cam.far!=n)&&(this._cam.far=n,this._cam.updateProjectionMatrix())}applyClippingPlane(){this._cam&&(this._cam.near=this._nearClipPlane,this._cam.far=this._farClipPlane,this._cam.updateProjectionMatrix())}get clearFlags(){return this._clearFlags}set clearFlags(n){if(typeof n=="string")switch(n){case"skybox":n=1;break;case"solidcolor":n=2;break;default:n=0;break}n!==this._clearFlags&&(this._clearFlags=n,this.applyClearFlagsIfIsActiveCamera())}set cullingMask(n){this._cullingMask=n,this._cam&&(this._cam.layers.mask=n)}get cullingMask(){return this._cam?this._cam.layers.mask:this._cullingMask}set cullingLayer(n){this.cullingMask=(1<<n|0)>>>0}set backgroundBlurriness(n){n!==this._backgroundBlurriness&&(n===void 0?this._backgroundBlurriness=void 0:this._backgroundBlurriness=Math.min(Math.max(n,0),1),this.applyClearFlagsIfIsActiveCamera())}get backgroundBlurriness(){return this._backgroundBlurriness}set backgroundIntensity(n){n!==this._backgroundIntensity&&(n===void 0?this._backgroundIntensity=void 0:this._backgroundIntensity=Math.min(Math.max(n,0),10),this.applyClearFlagsIfIsActiveCamera())}get backgroundIntensity(){return this._backgroundIntensity}set backgroundRotation(n){n!==this._backgroundRotation&&(n===void 0?this._backgroundRotation=void 0:this._backgroundRotation=n,this.applyClearFlagsIfIsActiveCamera())}get backgroundRotation(){return this._backgroundRotation}set environmentIntensity(n){this._environmentIntensity=n}get environmentIntensity(){return this._environmentIntensity}get backgroundColor(){return this._backgroundColor??null}set backgroundColor(n){n&&(this._backgroundColor||(this._backgroundColor=new he(1,1,1,1)),this._backgroundColor.copy(n),(!("alpha"in n)||n.alpha===void 0)&&(this._backgroundColor.alpha=1),this.applyClearFlagsIfIsActiveCamera())}set targetTexture(n){this._targetTexture=n}get targetTexture(){return this._targetTexture}get cam(){return this.threeCamera}get threeCamera(){return this.activeAndEnabled&&this.buildCamera(),this._cam}screenPointToRay(n,e,t){const s=this.threeCamera,o=Lo._origin;o.set(n,e,-1),this.context.input.convertScreenspaceToRaycastSpace(o),Mx&&console.log("screenPointToRay",n.toFixed(2),e.toFixed(2),"now:",o.x.toFixed(2),o.y.toFixed(2),"isInXR:"+this.context.isInXR),o.z=-1,o.unproject(s);const r=Lo._direction.set(o.x,o.y,o.z),l=ee(s);return r.sub(l),r.normalize(),t?(t.set(l,r),t):new mo(l.clone(),r.clone())}getFrustum(){return this._frustum||(this._frustum=new Bv,this.updateFrustum()),this._frustum}updateFrustum(){this._frustum||(this._frustum=new Bv),this._frustum.setFromProjectionMatrix(this.getProjectionScreenMatrix(this._projScreenMatrix,!0),this.context.renderer.coordinateSystem)}getProjectionScreenMatrix(n,e){return e&&this._projScreenMatrix.multiplyMatrices(this.threeCamera.projectionMatrix,this.threeCamera.matrixWorldInverse),n===this._projScreenMatrix?n:n.copy(this._projScreenMatrix)}awake(){Mx&&window.addEventListener("pointerdown",n=>{const e=n.clientX,t=n.clientY;console.log("touch",e.toFixed(2),t.toFixed(2));const s=this.screenPointToRay(e,t),o="#"+Math.floor(Math.random()*16777215).toString(16);G.DrawRay(s.origin,s.direction,o,10)})}onEnable(){Io&&console.log(`Camera enabled: "${this.name}". ClearFlags=${Ur[this._clearFlags]}`,this),this.buildCamera(),(this.tag=="MainCamera"||!this.context.mainCameraComponent)&&(this.context.setCurrentCamera(this),jT(this)),this.applyClearFlagsIfIsActiveCamera({applySkybox:!0})}onDisable(){this.context.removeCamera(this)}onBeforeRender(){if(this._cam&&(this._frustum&&this.updateFrustum(),this._clearFlags===2&&this.applyClearFlagsIfIsActiveCamera(),this._targetTexture)){this.context.isManagedExternally&&(this._warnedAboutExternalRenderer||(this._warnedAboutExternalRenderer=!0,console.warn("Rendering with external renderer is not supported yet. This may not work or throw errors. Please remove the the target texture from your camera: "+this.name,this.targetTexture))),this.context.composer;const n=this.context.renderer;if(n){const e=this.context.mainCameraComponent;this.applyClearFlags(),this._targetTexture.render(this.context.scene,this._cam,n),e?.applyClearFlags()}}}buildCamera(){if(this._cam)return;const n=this.gameObject.isCamera;let e=null;if(n?(e=this.gameObject,e?.layers.enableAll(),e instanceof we&&(this._fov=e.fov)):e=this.gameObject.children[0],e&&e.isCamera)e instanceof we&&(this._fov&&(e.fov=this._fov),e.near=this._nearClipPlane,e.far=this._farClipPlane,e.updateProjectionMatrix());else if(!this.orthographic)e=new we(this.fieldOfView,window.innerWidth/window.innerHeight,this._nearClipPlane,this._farClipPlane),this.fieldOfView&&(e.fov=this.fieldOfView),this.gameObject.add(e);else{const t=this.orthographicSize*100;e=new pd(window.innerWidth/-t,window.innerWidth/t,window.innerHeight/t,window.innerHeight/-t,this._nearClipPlane,this._farClipPlane),this.gameObject.add(e)}this._cam=e,this._cam.layers.mask=this._cullingMask,this.tag=="MainCamera"&&this.context.setCurrentCamera(this)}applyClearFlagsIfIsActiveCamera(n){this.context.mainCameraComponent===this&&this.applyClearFlags(n)}applyClearFlags(n){var e;if(!this._cam){Io&&console.log("Camera does not exist (apply clear flags)");return}if(this.fieldOfView=this._fov,Io){const s=`[Camera] Apply ClearFlags: ${Ur[this._clearFlags]} - "${this.name}"`;console.debug(s)}const t=this.context.domElement.getAttribute("background-image")||this.context.domElement.getAttribute("background-color");switch(this._clearFlags){case 0:return;case 1:if(Lo.backgroundShouldBeTransparent(this.context)&&(!this.ARBackgroundAlpha||this.ARBackgroundAlpha<.001)){this.context.scene.background=null,this.context.renderer.setClearColor(0,0);return}(!this.scene.background||!this._skybox||n?.applySkybox===!0)&&this.applySceneSkybox(),this._backgroundBlurriness!==void 0&&!this.context.domElement.getAttribute("background-blurriness")?this.context.scene.backgroundBlurriness=this._backgroundBlurriness:Io&&console.warn(`Camera "${this.name}" has no background blurriness`),this._backgroundIntensity!==void 0&&!this.context.domElement.getAttribute("background-intensity")&&(this.context.scene.backgroundIntensity=this._backgroundIntensity),this._backgroundRotation!==void 0&&!this.context.domElement.getAttribute("background-rotation")?this.context.scene.backgroundRotation=this._backgroundRotation:Io&&console.warn(`Camera "${this.name}" has no background intensity`);break;case 2:if(this._backgroundColor&&!t){let s=this._backgroundColor.alpha;Lo.backgroundShouldBeTransparent(this.context)&&(s=this.ARBackgroundAlpha??0),this.context.scene.background=null,(e=this.context.xr)!=null&&e.isVR?this.context.renderer.setClearColor(Rb(this._backgroundColor).convertLinearToSRGB()):this.context.renderer.setClearColor(this._backgroundColor,s)}else this._backgroundColor||Io&&console.warn(`[Camera] has no background color "${this.name}" `);break;case 4:t||(this.context.scene.background=null,this.context.renderer.setClearColor(0,0));break}}applySceneSkybox(){this._skybox||(this._skybox=new LT(this)),this._skybox.apply()}static backgroundShouldBeTransparent(n){var e,t,s,o;const r=(e=n.renderer.xr)==null?void 0:e.getSession();if(!r)return!1;if(typeof r._transparent=="boolean")return r._transparent;const l=r.environmentBlendMode;Io&&De("Environment blend mode: "+l+" on "+navigator.userAgent);let c=l==="additive"||l==="alpha-blend";return n.isInAR&&l==="opaque"&&((t=navigator.userAgent)!=null&&t.includes("OculusBrowser")||(s=navigator.userAgent)!=null&&s.includes("Mozilla")&&(o=navigator.userAgent)!=null&&o.includes("Mobile WebXRViewer/v2"))&&(c=!0),r._transparent=c,c}},a(Lo,"_origin",new S),a(Lo,"_direction",new S),Lo);Kt([m()],Ut.prototype,"aspect",1),Kt([m()],Ut.prototype,"fieldOfView",1),Kt([m()],Ut.prototype,"nearClipPlane",1),Kt([m()],Ut.prototype,"farClipPlane",1),Kt([m()],Ut.prototype,"clearFlags",1),Kt([m()],Ut.prototype,"orthographic",2),Kt([m()],Ut.prototype,"orthographicSize",2),Kt([m()],Ut.prototype,"ARBackgroundAlpha",2),Kt([m()],Ut.prototype,"cullingMask",1),Kt([m()],Ut.prototype,"backgroundBlurriness",1),Kt([m()],Ut.prototype,"backgroundIntensity",1),Kt([m(Dt)],Ut.prototype,"backgroundRotation",1),Kt([m()],Ut.prototype,"environmentIntensity",1),Kt([m(he)],Ut.prototype,"backgroundColor",1),Kt([m(Ic)],Ut.prototype,"targetTexture",1);let hi=Ut;class LT{constructor(e){a(this,"_camera"),a(this,"_skybox"),this._camera=e}get context(){var e;return(e=this._camera)==null?void 0:e.context}apply(){var e;if(this._skybox=this.context.lightmaps.tryGetSkybox(this._camera.sourceId),!this._skybox)this._did_log_failed_to_find_skybox||(this._did_log_failed_to_find_skybox=!0,console.warn(`Camera "${this._camera.name}" has no skybox texture. ${this._camera.sourceId}`));else if(this.context.scene.background!==this._skybox){const t=this.context.domElement.getAttribute("background-image")||this.context.domElement.getAttribute("background-color")||this.context.domElement.getAttribute("skybox-image");Io&&console.debug(`[Camera] Apply Skybox ${(e=this._skybox)==null?void 0:e.name} ${t} - "${this._camera.name}"`),t!=null&&t.length||(this._skybox.mapping=kn,this.context.scene.background=this._skybox)}}}function jT(n){C("freecam")&&n.context.mainCameraComponent===n&&P.getOrAddComponent(n.gameObject,_e)}class Nn extends j{constructor(){super(...arguments),a(this,"_listener",null),a(this,"onInteraction",()=>{this.destroyed||this.listener==null||this.addListenerIfItExists()})}get listener(){return this._listener==null&&(this._listener=new YC),this._listener}onEnable(){Ln.registerWaitForInteraction(this.onInteraction),this.addListenerIfItExists()}onDisable(){Ln.unregisterWaitForInteraction(this.onInteraction),this.removeListenerIfItExists()}addListenerIfItExists(){const e=this._listener;if(!e||e!=null&&e.parent)return;const t=this.context.mainCameraComponent||P.getComponentInParent(this.gameObject,hi);t!=null&&t.threeCamera?t.threeCamera.add(e):this.gameObject.add(e),e.filter?(e.gain.connect(e.filter),e.filter.connect(e.context.destination)):e.gain.connect(e.context.destination)}removeListenerIfItExists(){const e=this._listener;e&&(e.removeFromParent(),e.filter&&e.filter.disconnect(),e.gain&&e.gain.disconnect())}}var DT=Object.defineProperty,BT=Object.getOwnPropertyDescriptor,Ps=(n,e,t,s)=>{for(var o=s>1?void 0:s?BT(e,t):e,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=(s?l(e,t,o):l(o))||o);return s&&o&&DT(e,t,o),o};const Et=C("debugaudio"),ss=class dr extends j{constructor(){super(...arguments),a(this,"clip",""),a(this,"playOnAwake",!1),a(this,"preload",!0),a(this,"playInBackground",!0),a(this,"_spatialBlend",0),a(this,"_minDistance",1),a(this,"_maxDistance",100),a(this,"_volume",1),a(this,"rollOffMode",0),a(this,"_loop",!1),a(this,"sound",null),a(this,"helper",null),a(this,"wasPlaying",!1),a(this,"audioLoader",null),a(this,"shouldPlay",!1),a(this,"_lastClipStartedLoading",null),a(this,"_audioElement",null),a(this,"onVisibilityChanged",()=>{switch(document.visibilityState){case"hidden":(this.playInBackground===!1||Q.isMobileDevice())&&(this.wasPlaying=this.isPlaying,this.isPlaying&&this.pause());break;case"visible":Et&&console.log("visible",this.enabled,this.playOnAwake,!this.isPlaying,dr.userInteractionRegistered,this.wasPlaying),this.enabled&&this.playOnAwake&&!this.isPlaying&&dr.userInteractionRegistered&&this.wasPlaying&&this.play();break}}),a(this,"onApplicationMuteChanged",()=>{var e,t;this.context.application.muted?(e=this.sound)==null||e.setVolume(0):(t=this.sound)==null||t.setVolume(this.volume)}),a(this,"createAudio",e=>{if(this.destroyed){Et&&console.warn("AudioSource destroyed, not creating audio",this.name);return}Et&&console.log("AudioBuffer finished loading",e);const t=this.Sound;if(!t){Et&&console.warn("Failed getting sound?",this.name);return}t.isPlaying&&t.stop(),e&&t.setBuffer(e),t.loop=this._loop,this.context.application.muted?t.setVolume(0):t.setVolume(this.volume),t.autoplay=this.shouldPlay&&dr.userInteractionRegistered,this.applySpatialDistanceSettings(),t.isPlaying&&t.stop(),dr.registerWaitForAllowAudio(this.__onAllowAudioCallback)}),a(this,"__onAllowAudioCallback",()=>{this.shouldPlay&&this.play()}),a(this,"_lastContextTime",0),a(this,"_hasEnded",!0),a(this,"_needUpdateSpatialDistanceSettings",!1)}static get userInteractionRegistered(){return Ln.userInteractionRegistered}static registerWaitForAllowAudio(e){Ln.registerWaitForInteraction(e)}get isPlaying(){var e;return((e=this.sound)==null?void 0:e.isPlaying)??!1}get duration(){var e,t;return(t=(e=this.sound)==null?void 0:e.buffer)==null?void 0:t.duration}get time01(){var e;const t=this.duration;return t&&this.sound?((e=this.sound)==null?void 0:e.context.currentTime)/t:0}set time01(e){const t=this.duration;t&&this.sound&&(this.time=e*t)}get time(){var e,t;return(e=this.sound)!=null&&e.source?((t=this.sound.source)==null?void 0:t.context.currentTime)-this._lastContextTime+this.sound.offset:0}set time(e){if(this.sound){if(e===this.sound.offset)return;const t=this.isPlaying;this.stop(),this.sound.offset=e,t&&this.play()}}get loop(){return this.sound&&(this._loop=this.sound.getLoop()),this._loop}set loop(e){this._loop=e,this.sound&&this.sound.setLoop(e)}get spatialBlend(){return this._spatialBlend}set spatialBlend(e){e!==this._spatialBlend&&(this._spatialBlend=e,this._needUpdateSpatialDistanceSettings=!0)}get minDistance(){return this._minDistance}set minDistance(e){this._minDistance!==e&&(this._minDistance=e,this._needUpdateSpatialDistanceSettings=!0)}get maxDistance(){return this._maxDistance}set maxDistance(e){this._maxDistance!==e&&(this._maxDistance=e,this._needUpdateSpatialDistanceSettings=!0)}get volume(){return this._volume}set volume(e){this._volume=e,this.sound&&!this.context.application.muted&&(Et&&console.log(this.name,"audio set volume",e),this.sound.setVolume(e))}set pitch(e){this.sound&&this.sound.setPlaybackRate(e)}get pitch(){return this.sound?this.sound.getPlaybackRate():1}get Sound(){var e;if(!this.sound&&dr.userInteractionRegistered){let t=this.gameObject.getComponent(Nn)??this.context.mainCamera.getComponent(Nn)??Sc(Nn,this.context,!1);!t&&this.context.mainCamera&&(t=this.context.mainCamera.addComponent(Nn)),t!=null&&t.listener?(this.sound=new KC(t.listener),(e=this.gameObject)==null||e.add(this.sound)):Et&&console.warn("No audio listener found in scene - can not play audio")}return this.sound}get ShouldPlay(){return this.shouldPlay}get audioContext(){var e;return(e=this.sound)==null?void 0:e.context}awake(){Et&&console.log("[AudioSource]",this),this.audioLoader=new Dm,this.playOnAwake&&(this.shouldPlay=!0),this.preload&&typeof this.clip=="string"&&this.audioLoader.load(this.clip,this.createAudio,()=>{},console.error)}onEnable(){this.sound&&this.gameObject.add(this.sound),dr.userInteractionRegistered?this.playOnAwake&&this.context.application.isVisible&&this.play():dr.registerWaitForAllowAudio(()=>{this.enabled&&!this.destroyed&&this.shouldPlay&&this.onNewClip(this.clip)}),globalThis.addEventListener("visibilitychange",this.onVisibilityChanged),this.context.application.addEventListener(kg.MuteChanged,this.onApplicationMuteChanged)}onDisable(){globalThis.removeEventListener("visibilitychange",this.onVisibilityChanged),this.context.application.removeEventListener(kg.MuteChanged,this.onApplicationMuteChanged),this.pause()}applySpatialDistanceSettings(){const e=this.sound;if(!e)return;this._needUpdateSpatialDistanceSettings=!1;const t=W.lerp(10*this._maxDistance/Math.max(1e-4,this.spatialBlend),this._minDistance,this.spatialBlend);switch(Et&&console.log(this.name,this._minDistance,this._maxDistance,this.spatialBlend,"Ref distance="+t),e.setRefDistance(t),e.setMaxDistance(Math.max(.01,this._maxDistance)),this.rollOffMode){case 0:e.setDistanceModel("exponential");break;case 1:e.setDistanceModel("linear");break;case 2:console.warn("Custom rolloff for AudioSource is not supported: "+this.name);break}this.spatialBlend>0?Et&&!this.helper&&(this.helper=new tO(e,e.getRefDistance()),e.add(this.helper)):this.helper&&this.helper.parent&&this.helper.removeFromParent()}async onNewClip(e){if(e&&(this.clip=e),typeof e=="string")if(Et&&console.log(e),e.endsWith(".mp3")||e.endsWith(".wav")){if(this.audioLoader||(this.audioLoader=new Dm),this.shouldPlay=!0,this._lastClipStartedLoading===e){Et&&console.log("Is currently loading:",this._lastClipStartedLoading,this);return}this._lastClipStartedLoading=e,Et&&console.log("load audio",e);const t=await this.audioLoader.loadAsync(e).catch(console.error);if(this.destroyed)return;this._lastClipStartedLoading===e&&(this._lastClipStartedLoading=null),t&&this.createAudio(t)}else console.warn("Unsupported audio clip type",e);else this.shouldPlay=!0,this.createAudio()}play(e=void 0){var t,s,o;!e&&this.clip&&(e=this.clip),e!==void 0&&typeof e!="string"&&!(e instanceof MediaStream)&&(B()&&console.warn("Called play on AudioSource with unknown argument type:",e+`
|
|
940
|
+
Could not find method ${d.method} on object ${p.name}`,p,typeof p[d.method])};if(typeof p[d.method]!="function"){let y=!1,v=p;for(;v;){const b=Object.getOwnPropertyDescriptor(v,d.method);if(b&&(b.writable===!0||b.set)){y=!0;break}v=Object.getPrototypeOf(v)}!y&&(B()||wt)&&f()}}if(p){let f=d.argument;if(f!==void 0?f=u(f):d.arguments!==void 0&&(f=d.arguments.map(u)),!p[d.method])console.warn(`EventList method not found: "${d.method}" on ${p?.name}`);else{f!==void 0&&!Array.isArray(f)&&(f=[f]);const y=new zn(p,d.method,f,d.enabled);l.push(y)}}else B()&&console.warn("[Debug] EventList: Could not find event listener in scene",d,t.object,e)}const c=new xe(l);wt&&console.log(c);const h=t.target;return h!==void 0&&t.path!==void 0&&c.setEventTarget(t.path,h),c}}}const CT=new ST,Au=new WeakMap,PT=je.prototype.clone;je.prototype.clone=function(){const n=PT.call(this);return Au.has(n)||Au.set(n,this),n};class Cx extends es{constructor(){super([Ic,Vs])}onSerialize(e,t){}onDeserialize(e,t){if(e instanceof je&&t.type===Ic){let s=e;Au.has(s)&&(s=Au.get(s)),s.isRenderTargetTexture=!0,s.flipY=!0,s.offset.y=1,s.repeat.y=-1,s.needsUpdate=!0,s.mipmaps=[],s instanceof XC&&(s.isCompressedTexture=!1,s.format=yd);const o=new Ic(s.image.width,s.image.height,{colorSpace:On});return o.texture=s,o}}}new Cx;class Px extends es{constructor(){super([URL])}onSerialize(e,t){return null}onDeserialize(e,t){if(typeof e=="string"&&e.length>0)return vo(t.gltfId,e)}}new Px;var OT=Object.defineProperty,kT=(n,e,t,s)=>{for(var o=void 0,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=l(e,t,o)||o);return o&&OT(e,t,o),o};class Ka extends j{awake(){si.createIfNoneExists(this.context)}onEnable(){var e;(e=si.get(this.context))==null||e.register(this)}onDisable(){var e;(e=si.get(this.context))==null||e.unregister(this)}}class ji extends Ka{constructor(){super(...arguments),a(this,"targets",null),a(this,"raycastHits",[]),a(this,"ignoreSkinnedMeshes",!1)}start(){this.targets=[this.gameObject]}performRaycast(e=null){if(!this.targets)return null;e??(e=new Dn),e.targets=this.targets,e.results=this.raycastHits,e.useAcceleratedRaycast=!0;const t=e.testObject;this.ignoreSkinnedMeshes&&(e.testObject=o=>o instanceof Pn?"continue in children":t?t(o):!0);const s=this.context.physics.raycast(e);return e.testObject=t,s}}kT([m()],ji.prototype,"ignoreSkinnedMeshes");class Iu extends ji{constructor(){super(),this.ignoreSkinnedMeshes=!0}}const Ox=class yC extends Ka{performRaycast(e){if(!oe.active||!yC.allow||!(e!=null&&e.ray))return null;const t=e.ray.origin;return this.context.physics.sphereOverlap(t,.015,!1,!0)}};a(Ox,"allow",!0);let Bc=Ox;class Wf{static getObject(e){const t=e[Ri];return t&&(t.isComponent===!0?e=t.gameObject:e=t),e}static isInteractable(e,t){if(t&&(t.canvasGroup=void 0,t.graphic=void 0),e==null||!e.visible||(e=this.getObject(e),!e.visible))return!1;const s=this.tryFindCanvasGroup(e);if(s?.isCanvasGroup===!0&&(t&&(t.canvasGroup=s),s.blocksRaycasts===!1||s.interactable===!1))return!1;const o=Er(e,r=>{if(r.isGraphic===!0)return r},!1);return t&&o?.isGraphic===!0&&(t.graphic=o),!(o?.raycastTarget===!1||o?.layer===2)}static tryFindCanvasGroup(e){if(!e)return null;const t=Er(e,s=>{const o=s;if(o.blocksRaycasts!==void 0&&o.interactable!==void 0)return o},!1);return t!==void 0?t:this.tryFindCanvasGroup(e.parent)}}function Vf(n){return n[Ri]||(n.parent?Vf(n.parent):null)}function MT(n){return n.isUI===!0||typeof n[Ri]=="object"}function Lu(n,e){if(!n)return;const t=n.material;if(t?.isMaterial===!0){const s=n.parent;s&&s.isText,t.side=e.doubleSided??!0?Oi:yo,t.shadowSide=e.doubleSided?Oi:yo,n.castShadow=e.castShadows?e.castShadows:!1,n.receiveShadow=e.receiveShadows?e.receiveShadows:!1}for(const s of n.children)Lu(s,e)}function Za(n,e,t){n[e]===void 0&&console.warn("Field",e,"is undefined on",n);const s=Proxy.revocable(n[e],{set(l,c,h,d){const u=l[c],p=Reflect.set(l,c,h,d);return t(h,u),p}}),o=s.revoke,r=n[e];return s.revoke=()=>{n[e]=r,o()},n[e]=s.proxy,s}const kx=Symbol("Scheduled action");function RT(n,e,t=Oe.OnBeforeRender){let s=n[kx];s||(s=n[kx]={});const o=e.name;s[t]||(s[t]={});const r=s[t];if(r[o])return;function*l(){e?.call(n),r[o]=null}const c=n.startCoroutine(l(),t);r[o]=c}const Eo=C("debugeventsystem");var $f=(n=>(n.BeforeHandleInput="BeforeHandleInput",n.AfterHandleInput="AfterHandleInput",n))($f||{});nx(n=>{si.createIfNoneExists(n)});class si extends j{constructor(){super(...arguments),a(this,"raycaster",[]),a(this,"pressedByID",new Map),a(this,"hoveredByID",new Map),a(this,"onPointerEvent",e=>{if(e===void 0||e.propagationStopped||e.defaultPrevented||e.used)return;const t=new hd(this.context.input,e);this._currentPointerEventName=e.type,t.inputSource=this.context.input,t.isClick=e.isClick,t.isDoubleClick=e.isDoubleClick,t.isDown=e.type==Be.PointerDown,t.isUp=e.type==Be.PointerUp,t.isPressed=this.context.input.getPointerPressed(e.pointerId);const s=new Dn;e.hasRay?s.ray=e.ray:s.screenPoint=this.context.input.getPointerPositionRC(e.pointerId),s.allowSlowRaycastFallback=e.isClick||e.isDoubleClick;const o=this.performRaycast(s);if(Eo&&(t.isDown?console.log("DOWN",{id:t.pointerId,hits:o.length}):t.isUp&&console.log("UP",{id:t.pointerId,hits:o.length}),t.isClick&&console.log("CLICK",{id:t.pointerId,hits:o.length})),o){for(const l of o)l.event=e,e.intersections.push(l);e.origin.onPointerHits&&e.origin.onPointerHits({sender:this,event:e,hits:o})}Eo&&t.isClick&&De("EventSystem: "+t.pointerId+" - "+this.context.time.frame+" - Up:"+t.isUp+", Down:"+t.isDown);const r={sender:this,args:t,hasActiveUI:this.currentActiveMeshUIComponents.length>0};this.dispatchEvent(new CustomEvent("BeforeHandleInput",{detail:r})),this.handleIntersections(o,t),this.dispatchEvent(new CustomEvent("AfterHandleInput",{detail:r}))}),a(this,"_sortedHits",[]),a(this,"_testObjectsCache",new Map),a(this,"_currentlyActiveRaycaster",null),a(this,"_currentPointerEventName",null),a(this,"shouldRaycastObject",e=>{var t;const s=e&&"getComponent"in e?e.getComponent(Ka):null;if(s&&s!=this._currentlyActiveRaycaster)return!1;let o=null;if(MT(e)&&(o=(t=e[Ri])==null?void 0:t.gameObject),this._testObjectsCache.has(e)||o&&this._testObjectsCache.has(o))return this._testObjectsCache.get(e)===!1?"continue in children":!0;{let r=Ru(e,this._currentPointerEventName);if(!r&&o&&(r=Ru(o,this._currentPointerEventName)),r){this._testObjectsCache.set(e,!0);for(const l of e.children)this.shouldRaycastObject_AddToYesCache(l);return!0}return this._testObjectsCache.set(e,!1),"continue in children"}}),a(this,"_sortingBuffer",[]),a(this,"_noDepthTestingResults",[]),a(this,"out",{}),a(this,"_capturedPointer",{}),a(this,"pointerEnterSymbol",Symbol("pointerEnter")),a(this,"pointerExitSymbol",Symbol("pointerExit")),a(this,"currentActiveMeshUIComponents",[])}static ensureUpdateMeshUI(e,t,s=!1){Ao.update(e,t,s)}static markUIDirty(e){Ao.markDirty()}static createIfNoneExists(e){e.scene.getComponent(si)||e.scene.addComponent(si)}static get(e){return this.createIfNoneExists(e),e.scene.getComponent(si)}static get instance(){return this.get(J.Current)}register(e){var t;e&&this.raycaster&&!this.raycaster.includes(e)&&((t=this.raycaster)==null||t.push(e))}unregister(e){var t,s;const o=(t=this.raycaster)==null?void 0:t.indexOf(e);o!==void 0&&o!==-1&&((s=this.raycaster)==null||s.splice(o,1))}get hasActiveUI(){return this.currentActiveMeshUIComponents.length>0}get isHoveringObjects(){return this.hoveredByID.size>0}awake(){this.gameObject!==this.context.scene&&(console.debug(`[Needle Engine] EventSystem is only allowed on the scene root. Disabling EventSystem on '${this.gameObject.name}'`),this.enabled=!1)}start(){this.context.scene.getComponent(Ka)||this.context.scene.addComponent(ji)}onEnable(){this.context.input.addEventListener(Be.PointerDown,this.onPointerEvent),this.context.input.addEventListener(Be.PointerUp,this.onPointerEvent),this.context.input.addEventListener(Be.PointerMove,this.onPointerEvent)}onDisable(){this.context.input.removeEventListener(Be.PointerDown,this.onPointerEvent),this.context.input.removeEventListener(Be.PointerUp,this.onPointerEvent),this.context.input.removeEventListener(Be.PointerMove,this.onPointerEvent)}onBeforeRender(){this.resetMeshUIStates()}shouldRaycastObject_AddToYesCache(e){this._testObjectsCache.set(e,!0);for(const t of e.children)this.shouldRaycastObject_AddToYesCache(t)}performRaycast(e){if(!this.raycaster)return null;this._testObjectsCache.clear(),this._sortedHits.length=0,e.testObject=this.shouldRaycastObject;for(const t of this.raycaster){if(!t.activeAndEnabled)continue;this._currentlyActiveRaycaster=t;const s=t.performRaycast(e);this._currentlyActiveRaycaster=null,s&&s.length>0&&this._sortedHits.push(...s)}return this._sortedHits.sort((t,s)=>t.distance-s.distance),this._sortedHits}assignHitInformation(e,t){t?(e.intersection=t,e.point=t.point,e.normal=t.normal,e.face=t.face,e.distance=t.distance,e.instanceId=t.instanceId):(e.intersection=void 0,e.point=void 0,e.normal=void 0,e.face=void 0,e.distance=void 0,e.instanceId=void 0)}handleIntersections(e,t){var s;if(e!=null&&e.length){e=this.sortCandidates(e);for(const r of e){if(t.event.immediatePropagationStopped)return!1;if(this.assignHitInformation(t,r),this.handleEventOnObject(r.object,t))return!0}}this.assignHitInformation(t,e?.[0]),this.invokePointerCapture(t);const o=this.hoveredByID.get(t.pointerId);return o&&this.propagatePointerExit(o.obj,o.data,null),this.hoveredByID.delete(t.pointerId),t.isUp&&((s=this.pressedByID.get(t.pointerId))==null||s.handlers.forEach(r=>this.invokeOnPointerUp(t,r)),this.pressedByID.delete(t.pointerId)),!1}sortCandidates(e){this._sortingBuffer.length=0,this._noDepthTestingResults.length=0;for(let t=0;t<e.length;t++){const s=e[t],o=s.object;if(o.material&&o.material.depthTest===!1){this._noDepthTestingResults.push(s);continue}this._sortingBuffer.push(s)}for(const t of this._sortingBuffer)this._noDepthTestingResults.push(t);return this._noDepthTestingResults}handleEventOnObject(e,t){if(!this.testIsVisible(e))return t.isClick&&Eo&&console.log("not allowed",e),!1;if(t.pointerId===void 0)return Eo&&console.error("Event without pointer can't be handled",t),!1;t.object=e;const s=e.parent,o=t.isClick??!1;let r=null;if(s&&s.isUI){const d=(t.isPressed||t.isClick)??!1;if(s[Ri]){const u=s[Ri].gameObject;if(u){if(!Wf.isInteractable(u,this.out))return!1;r=this.out.canvasGroup??null,this.handleMeshUIIntersection(e,d),e=u}}}o&&Eo&&console.log(this.context.time.frame,e);const l=this.hoveredByID.get(t.pointerId),c=l?.obj;c!==e&&c&&this.propagatePointerExit(c,l.data,e);const h=this.hoveredByID.get(t.pointerId);if(h?(h.obj=e,h.data=t):this.hoveredByID.set(t.pointerId,{obj:e,data:t}),t.isDown){const d=this.pressedByID.get(t.pointerId);d?(d.obj=e,d.data=t):this.pressedByID.set(t.pointerId,{obj:e,data:t,handlers:new Set})}return(r===null||r.interactable)&&this.handleMainInteraction(e,t,c??null),!0}propagate(e,t){for(;e;)P.foreachComponent(e,s=>{t(s)},!1),e=e.parent}handleMainInteraction(e,t,s){const o=this.pressedByID.get(t.pointerId),r=s!==e;let l=!0;switch(t.event.pointerType){case"mouse":case"touch":const c=this.context.input.getPointerPositionLastFrame(t.pointerId),h=this.context.input.getPointerPosition(t.pointerId);l=c&&!W.approximately(c,h);break}this.propagate(e,c=>{var h;const d=c;d.interactable!==!1&&(!d.activeAndEnabled||!d.enabled||(d.onPointerEnter&&r&&this.handlePointerEnter(d,t),t.isDown&&d.onPointerDown&&(d.onPointerDown(t),o?.handlers.add(d),this.handlePointerCapture(t,d)),d.onPointerMove&&(l&&d.onPointerMove(t),this.handlePointerCapture(t,d)),t.isUp&&(d.onPointerUp&&(this.invokeOnPointerUp(t,d),o?.handlers.delete(d)),d.onPointerExit&&((h=t.event)==null?void 0:h.pointerType)===zd.Touch&&(this.handlePointerExit(d,t),this.hoveredByID.delete(t.pointerId))),t.isClick&&d.onPointerClick&&d.onPointerClick(t)))}),t.isUp&&(o?.handlers.forEach(c=>{this.invokeOnPointerUp(t,c)}),this.pressedByID.delete(t.pointerId))}propagatePointerExit(e,t,s){this.propagate(e,o=>{if(!o.gameObject||o.destroyed)return;const r=o;if(r.onPointerExit||r.onPointerEnter){if(s&&this.isChild(s,o.gameObject))return;this.handlePointerExit(r,t)}})}invokeOnPointerUp(e,t){var s;(s=t.onPointerUp)==null||s.call(t,e),this.releasePointerCapture(e,t)}handlePointerEnter(e,t){e.onPointerEnter&&this.updatePointerState(e,t.pointerId,this.pointerEnterSymbol,!0)&&e.onPointerEnter(t),this.updatePointerState(e,t.pointerId,this.pointerExitSymbol,!1)}handlePointerExit(e,t){e.onPointerExit&&this.updatePointerState(e,t.pointerId,this.pointerExitSymbol,!0)&&e.onPointerExit(t),this.updatePointerState(e,t.pointerId,this.pointerEnterSymbol,!1)}updatePointerState(e,t,s,o){let r=e[s];if(o)return r&&r.includes(t)?!1:(r=r||[],r.push(t),e[s]=r,!0);{if(!r||!r.includes(t))return!1;const l=r.indexOf(t);return l!==-1&&r.splice(l,1),!0}}handlePointerCapture(e,t){if(e.z__pointer_ctured){e.z__pointer_ctured=!1;const s=e.pointerId;if(t.onPointerMove){const o=this._capturedPointer[s]||[];o.push(t),this._capturedPointer[s]=o}else B()&&!t.z__warned_no_pointermove&&(t.z__warned_no_pointermove=!0,console.warn("PointerCapture was requested but the component doesn't implement onPointerMove. It will not receive any pointer events"))}else e.z__pointer_cture_rleased&&(e.z__pointer_cture_rleased=!1,this.releasePointerCapture(e,t))}releasePointerCapture(e,t){const s=e.pointerId;if(this._capturedPointer[s]){const o=this._capturedPointer[s].indexOf(t);o!==-1&&(this._capturedPointer[s].splice(o,1),Eo&&console.log("released pointer capture",s,t,this._capturedPointer))}}invokePointerCapture(e){var t;if(e.event.type===Be.PointerMove){const s=e.pointerId,o=this._capturedPointer[s];if(o){Eo&&console.log("Captured",s,o);for(let r=0;r<o.length;r++){const l=o[r];if(l.destroyed){o.splice(r,1),r--;continue}(t=l.onPointerMove)==null||t.call(l,e)}}}}isChild(e,t){return!e||!t?!1:e===t?!0:e.parent?this.isChild(e.parent,t):!1}handleMeshUiObjectWithoutShadowDom(e,t){return!e||!e.isUI?!0:this.handleMeshUIIntersection(e,t)}handleMeshUIIntersection(e,t){const s=Ao.updateState(e,t);return s&&this.currentActiveMeshUIComponents.push(s),s!==null}resetMeshUIStates(){if(this.context.input.getPointerPressedCount()>0&&Ao.resetLastSelected(),!(!this.currentActiveMeshUIComponents||this.currentActiveMeshUIComponents.length<=0)){for(let e=0;e<this.currentActiveMeshUIComponents.length;e++){const t=this.currentActiveMeshUIComponents[e];Ao.resetState(t)}this.currentActiveMeshUIComponents.length=0}}testIsVisible(e){return e?P.isActiveSelf(e)?this.testIsVisible(e.parent):!1:!0}}class Ao{static markDirty(){this.needsUpdate=!0}static update(e,t,s=!1){if(s){e.update();return}const o=t.time.frameCount;for(const r of this.lastUpdateFrame)if(r.context===t){if(o===r.frame)return;r.frame=o;let l=this.needsUpdate||o<1;r.nextUpdate<=o&&(l=!0),l&&(Eo&&console.log("Update threemeshui"),this.needsUpdate=!1,r.nextUpdate=o+60,e.update());return}this.lastUpdateFrame=[{context:t,frame:o,nextUpdate:o+60}],e.update(),this.needsUpdate=!1}static updateState(e,t){let s=null;if(e&&(s=this.findBlockOrTextInParent(e),s&&s!==this.lastSelected)){if(s.interactable===!1)return null;this.needsUpdate=!0}return s}static resetLastSelected(){const e=this.lastSelected;e&&(this.lastSelected=null,this.resetState(e))}static resetState(e){e&&(this.needsUpdate=!0)}static findBlockOrTextInParent(e){return e?e.isBlock||e.isText?e:this.findBlockOrTextInParent(e.parent):null}}a(Ao,"lastSelected",null),a(Ao,"lastUpdateFrame",[]),a(Ao,"needsUpdate",!1);var TT=Object.defineProperty,Ue=(n,e,t,s)=>{for(var o=void 0,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=l(e,t,o)||o);return o&&TT(e,t,o),o};const is=C("debugorbit"),Hf=C("freecam"),Fc=C("debugcamerafit"),ju=C("smoothcam"),ET={LEFT:"",UP:"",RIGHT:"",BOTTOM:""};let Gf;class Uc extends CustomEvent{constructor(e,t){super("target-reached",{detail:{controls:e,type:t}})}}class _e extends j{constructor(){super(...arguments),a(this,"autoTarget",!0),a(this,"autoFit",!1),a(this,"enableRotate",!0),a(this,"autoRotate",!1),a(this,"autoRotateSpeed",1),a(this,"minAzimuthAngle",1/0),a(this,"maxAzimuthAngle",1/0),a(this,"minPolarAngle",0),a(this,"maxPolarAngle",Math.PI),a(this,"enableKeys",!1),a(this,"enableDamping",!0),a(this,"dampingFactor",.1),a(this,"enableZoom",!0),a(this,"minZoom",0),a(this,"maxZoom",1/0),a(this,"zoomSpeed",1),a(this,"zoomToCursor",!1),a(this,"enablePan",!0),a(this,"lookAtConstraint",null),a(this,"lookAtConstraint01",1),a(this,"allowInterrupt",!0),a(this,"middleClickToFocus",!0),a(this,"doubleClickToFocus",!0),a(this,"clickBackgroundToFitScene",2),a(this,"_targetElement",null),a(this,"debugLog",!1),a(this,"targetLerpDuration",1),a(this,"_controls",null),a(this,"_cameraObject",null),a(this,"_lookTargetLerpActive",!1),a(this,"_lookTargetStartPosition",new S),a(this,"_lookTargetEndPosition",new S),a(this,"_lookTargetLerp01",0),a(this,"_lookTargetLerpDuration",0),a(this,"_cameraLerpActive",!1),a(this,"_cameraStartPosition",new S),a(this,"_cameraEndPosition",new S),a(this,"_cameraLerp01",0),a(this,"_cameraLerpDuration",0),a(this,"_fovLerpActive",!1),a(this,"_fovLerpStartValue",0),a(this,"_fovLerpEndValue",0),a(this,"_fovLerp01",0),a(this,"_fovLerpDuration",0),a(this,"_inputs",0),a(this,"_enableTime",0),a(this,"_startedListeningToKeyEvents",!1),a(this,"_eventSystem"),a(this,"_afterHandleInputFn"),a(this,"_camera",null),a(this,"_syncedTransform"),a(this,"_didSetTarget",0),a(this,"_activePointerEvents"),a(this,"_lastTimeClickOnBackground",-1),a(this,"_clickOnBackgroundCount",0),a(this,"_onPointerDown",e=>{this._activePointerEvents.push(e)}),a(this,"_onPointerDownLate",e=>{e.used&&this._controls&&(this._controls.enabled=!1)}),a(this,"_onPointerUp",e=>{for(let t=this._activePointerEvents.length-1;t>=0;t--){const s=this._activePointerEvents[t];if(s.pointerId===e.pointerId&&s.button===e.button){this._activePointerEvents.splice(t,1);break}}if(this.clickBackgroundToFitScene>0&&e.isClick&&e.button===0){if(e.hasRay||e.intersections.push(...this.context.physics.raycast()),e.intersections.length<=0){const t=this.context.time.time-this._lastTimeClickOnBackground;this._lastTimeClickOnBackground=this.context.time.time,this.clickBackgroundToFitScene<=1||t<this.clickBackgroundToFitScene*.15?(this._clickOnBackgroundCount+=1,this._clickOnBackgroundCount>=this.clickBackgroundToFitScene-1&&this.fitCamera(this.context.scene.children,{immediate:!1})):this._clickOnBackgroundCount=0}is&&console.log(this.clickBackgroundToFitScene,e.intersections.length,this._clickOnBackgroundCount)}}),a(this,"_onPointerUpLate",e=>{this.doubleClickToFocus&&e.isDoubleClick&&!e.used&&this.setTargetFromRaycast()}),a(this,"_orbitStartAngle",0),a(this,"_zoomStartDistance",0),a(this,"onControlsChangeStarted",()=>{this._controls&&(this._orbitStartAngle=this._controls.getAzimuthalAngle()+this._controls.getPolarAngle(),this._zoomStartDistance=this._controls.getDistance()),this._syncedTransform&&this._syncedTransform.requestOwnership()}),a(this,"onControlsChangeEnded",()=>{if(this._controls&&this.autoTarget){const e=this._controls.getAzimuthalAngle()+this._controls.getPolarAngle()-this._orbitStartAngle;Math.abs(e)<.01?(is&&console.debug("OrbitControls: Update target",{deltaAngle:e}),this.updateTargetNow({allowSlowRaycastFallback:!1})):is&&console.debug("OrbitControls: No target update",{deltaAngle:e})}}),a(this,"_shouldDisable",!1),a(this,"__onPreRender",()=>{const e=this.context.pre_render_callbacks.indexOf(this.__onPreRender);e>=0&&this.context.pre_render_callbacks.splice(e,1),this.autoFit&&(this.autoFit=!1,this.fitCamera({centerCamera:"y",immediate:!0,objects:this.scene.children}))}),a(this,"_haveAttachedKeyboardEvents",!1)}get isCameraController(){return!0}get controls(){return this._controls}get controllerObject(){return this._cameraObject}onStartInteraction(e){var t;(t=this.controls)==null||t.addEventListener("start",e)}get targetElement(){var e;return((e=this._controls)==null?void 0:e.domElement)??this._targetElement}set targetElement(e){this._targetElement=e,this._controls&&this._controls.domElement!==e&&(this._controls.disconnect(),this._controls.domElement=e,this._controls.connect())}get targetLerpSpeed(){return 5}set targetLerpSpeed(e){this.targetLerpDuration=1/e}rotateLeft(e){var t;(t=this._controls)==null||t._rotateLeft(e)}rotateUp(e){var t;(t=this._controls)==null||t._rotateUp(e)}pan(e,t){var s;(s=this._controls)==null||s._pan(e,t)}zoomIn(e){var t,s;e>0?(t=this._controls)==null||t._dollyIn(1-e):e<0&&((s=this._controls)==null||s._dollyOut(1+e))}awake(){is&&console.debug("OrbitControls",this),this._didSetTarget=0,this._startedListeningToKeyEvents=!1}start(){this._eventSystem=si.get(this.context)??void 0,this._eventSystem&&(this._afterHandleInputFn=this.afterHandleInput.bind(this),this._eventSystem.addEventListener($f.AfterHandleInput,this._afterHandleInputFn))}onDestroy(){var e,t;(e=this._controls)==null||e.dispose(),(t=this._eventSystem)==null||t.removeEventListener($f.AfterHandleInput,this._afterHandleInputFn)}onEnable(){this._didSetTarget=0,this._enableTime=this.context.time.time;const e=P.getComponent(this.gameObject,hi);this._camera=e;let t=e?.threeCamera;if(!t&&this.gameObject instanceof we&&(t=this.gameObject),t&&ag(t,this,!0),!this._controls&&t instanceof A){this._cameraObject=t;const s=this.targetElement??this.context.renderer.domElement,o=t?.quaternion.clone();this._controls=new Gv(t,s),t?.quaternion.copy(o),Gf===void 0&&(Gf={...this._controls.keys});const r=ee(t),l=this.gameObject.worldForward,c=r.clone().sub(l.multiplyScalar(2.5));this._controls.target.copy(c)}if(this._controls)if(Hf&&(this.enablePan=!0,this.enableZoom=!0,this.middleClickToFocus=!0,Q.isMobileDevice()&&(this.doubleClickToFocus=!0)),this._controls.addEventListener("start",this.onControlsChangeStarted),this._controls.addEventListener("endMovement",this.onControlsChangeEnded),!this._startedListeningToKeyEvents&&this.enableKeys)this._startedListeningToKeyEvents=!0,this._controls.listenToKeyEvents(this.context.domElement);else try{this._controls.stopListenToKeyEvents()}catch{}this._syncedTransform=P.getComponent(this.gameObject,sn)??void 0,this.context.pre_render_callbacks.push(this.__onPreRender),this._activePointerEvents=[],this.context.input.addEventListener("pointerdown",this._onPointerDown,{queue:ri.Early}),this.context.input.addEventListener("pointerdown",this._onPointerDownLate,{queue:ri.Late}),this.context.input.addEventListener("pointerup",this._onPointerUp,{queue:ri.Early}),this.context.input.addEventListener("pointerup",this._onPointerUpLate,{queue:ri.Late})}onDisable(){var e;if((e=this._camera)!=null&&e.threeCamera&&ag(this._camera.threeCamera,this,!1),this._controls){this._controls.enabled=!1,this._controls.autoRotate=!1,this._controls.removeEventListener("start",this.onControlsChangeStarted),this._controls.removeEventListener("endMovement",this.onControlsChangeEnded);try{this._controls.stopListenToKeyEvents()}catch{}this._startedListeningToKeyEvents=!1}this._activePointerEvents.length=0,this.context.input.removeEventListener("pointerdown",this._onPointerDown),this.context.input.removeEventListener("pointerdown",this._onPointerDownLate),this.context.input.removeEventListener("pointerup",this._onPointerUp),this.context.input.removeEventListener("pointerup",this._onPointerUpLate)}updateTargetNow(e){var t,s,o;const r=new mo((t=this._cameraObject)==null?void 0:t.worldPosition,(s=this._cameraObject)==null?void 0:s.worldForward.multiplyScalar(-1)),l=this.context.physics.raycastFromRay(r,e),c=l.length>0?l[0]:void 0;c&&c.distance>this.minZoom&&c.distance<this.maxZoom&&(is&&G.DrawWireSphere(c.point,.1,16711680,2),(o=this._controls)==null||o.target.copy(l[0].point))}afterHandleInput(e){e.detail.args.pointerId===0&&(e.detail.args.isDown?this._controls&&this._eventSystem&&(this._shouldDisable=this._eventSystem.hasActiveUI):(!e.detail.args.isPressed||e.detail.args.isUp)&&(this._shouldDisable=!1))}onBeforeRender(){var e,t,s,o;if(!!this._controls){if(this._cameraObject!==this.context.mainCamera){this._controls.enabled=!1;return}if(this._controls.enabled=!0,(this.context.input.getPointerDown(1)||this.context.input.getPointerDown(2)||this.context.input.mouseWheelChanged||this.context.input.getPointerPressed(0)&&(e=this.context.input.getPointerPositionDelta(0))!=null&&e.length())&&(this._inputs+=1),this._inputs>0&&this.allowInterrupt&&(this.enableRotate&&(this.autoRotate=!1),this._cameraLerpActive=!1,this._lookTargetLerpActive=!1),this._inputs=0,this.autoTarget&&this._didSetTarget++===0){const r=P.getComponent(this.gameObject,hi);if(r&&!this.setLookTargetFromConstraint()){this.debugLog&&console.log("NO TARGET");const l=ee(r.threeCamera),c=Math.max(.01,l.length()),h=new S(0,0,-c).applyMatrix4(r.threeCamera.matrixWorld);is&&G.DrawLine(l,h,5592575,10),this.setLookTargetPosition(h,!0)}if(!this.setLookTargetFromConstraint()){const l=new Dn;l.screenPoint=new ie(0,0),l.lineThreshold=.1;const c=this.context.physics.raycast(l);c.length>0&&this.setLookTargetPosition(c[0].point,!0),Fc&&console.log("OrbitControls hits",...c)}}if(this.middleClickToFocus&&this.context.input.getPointerClicked(1)&&this.setTargetFromRaycast(),this._lookTargetLerpActive||this._cameraLerpActive||this._fovLerpActive){if(this._cameraLerpActive&&this._cameraObject)if(this._cameraLerp01+=this.context.time.deltaTime/this._cameraLerpDuration,this._cameraLerp01>=1)this._cameraObject.position.copy(this._cameraEndPosition),this._cameraLerpActive=!1,this.dispatchEvent(new Uc(this,"camera"));else{const r=W.easeInOutCubic(this._cameraLerp01);this._cameraObject.position.lerpVectors(this._cameraStartPosition,this._cameraEndPosition,r)}if(this._lookTargetLerpActive)if(this._lookTargetLerp01+=this.context.time.deltaTime/this._lookTargetLerpDuration,this._lookTargetLerp01>=1)this._controls.target.copy(this._lookTargetEndPosition),this._lookTargetLerpActive=!1,this.dispatchEvent(new Uc(this,"lookat"));else{const r=W.easeInOutCubic(this._lookTargetLerp01);this._controls.target.lerpVectors(this._lookTargetStartPosition,this._lookTargetEndPosition,r)}if(this._fovLerpActive&&this._cameraObject){const r=this._cameraObject;if(this._fovLerp01+=this.context.time.deltaTime/this._fovLerpDuration,this._fovLerp01>=1)r.fov=this._fovLerpEndValue,this._fovLerpActive=!1;else{const l=W.easeInOutCubic(this._fovLerp01);r.fov=W.lerp(this._fovLerpStartValue,this._fovLerpEndValue,l)}r.updateProjectionMatrix()}}if(this._controls){if(this.debugLog&&(this._controls.domElement=this.context.renderer.domElement),this._controls.enabled=!this._shouldDisable&&this._camera===this.context.mainCameraComponent&&!this.context.isInXR&&!this._activePointerEvents.some(r=>r.used),this._controls.keys=this.enableKeys?Gf:ET,this._controls.autoRotate=this.autoRotate,this._controls.autoRotateSpeed=this.autoRotateSpeed,this._controls.enableZoom=this.enableZoom,this._controls.zoomSpeed=this.zoomSpeed,this._controls.zoomToCursor=this.zoomToCursor,this._controls.enableDamping=this.enableDamping,this._controls.dampingFactor=this.dampingFactor,this._controls.enablePan=this.enablePan,this._controls.enableRotate=this.enableRotate,this._controls.minAzimuthAngle=this.minAzimuthAngle,this._controls.maxAzimuthAngle=this.maxAzimuthAngle,this._controls.minPolarAngle=this.minPolarAngle,this._controls.maxPolarAngle=this.maxPolarAngle,Hf||(((s=(t=this._camera)==null?void 0:t.threeCamera)==null?void 0:s.type)==="PerspectiveCamera"?(this._controls.minDistance=this.minZoom,this._controls.maxDistance=this.maxZoom,this._controls.minZoom=0,this._controls.maxZoom=1/0):(this._controls.minDistance=0,this._controls.maxDistance=1/0,this._controls.minZoom=this.minZoom,this._controls.maxZoom=this.maxZoom)),typeof ju=="number"||ju===!0){this._controls.enableDamping=!0;const r=typeof ju=="number"?ju:.99;this._controls.dampingFactor=Math.max(.001,1-Math.min(1,r))}this.allowInterrupt||(this._lookTargetLerpActive&&(this._controls.enablePan=!1),this._cameraLerpActive&&(this._controls.enableRotate=!1,this._controls.autoRotate=!1),(this._lookTargetLerpActive||this._cameraLerpActive)&&(this._controls.enableZoom=!1)),this.context.isInXR||(!Hf&&(o=this.lookAtConstraint)!=null&&o.locked&&this.setLookTargetFromConstraint(0,this.lookAtConstraint01),this._controls.update(this.context.time.deltaTime),is&&G.DrawWireSphere(this._controls.target,.1,65280))}}}setCameraAndLookTarget(e,t=!1){if(!e)return(B()||is)&&console.warn("[OrbitControls] setCameraAndLookTarget target is null"),!1;if(!(e instanceof A)&&!(e instanceof hi))return(B()||is)&&console.warn("[OrbitControls] setCameraAndLookTarget target is not an Object3D or Camera"),!1;e instanceof hi&&(e=e.gameObject);const s=e.worldPosition,o=e.worldForward;e instanceof QC&&(is&&console.debug("[OrbitControls] setCameraAndLookTarget flip forward direction for camera"),o.multiplyScalar(-1));const r=new mo(s,o);return is&&G.DrawRay(r.origin,r.direction,16711680,10),this.setTargetFromRaycast(r,t)||this.setLookTargetPosition(r.at(2,X()),t),this.setCameraTargetPosition(s,t),!0}setCameraTargetPosition(e,t=!1){var s;e&&(e instanceof A&&(e=ee(e)),this._cameraEndPosition||(this._cameraEndPosition=new S),this._cameraEndPosition.copy(e),t===!0?(this._cameraLerpActive=!1,this._cameraObject&&this._cameraObject.position.copy(this._cameraEndPosition)):this._cameraObject&&(this._cameraLerpActive=!0,this._cameraLerp01=0,this._cameraStartPosition.copy((s=this._cameraObject)==null?void 0:s.position),typeof t=="number"?this._cameraLerpDuration=t:this._cameraLerpDuration=this.targetLerpDuration))}get cameraLerpActive(){return this._cameraLerpActive}stopCameraLerp(){this._cameraLerpActive=!1}setFieldOfView(e,t=!1){var s;if(!this._controls||typeof e!="number")return;const o=(s=this._camera)==null?void 0:s.threeCamera;o&&(t===!0?o.fov=e:(this._fovLerpActive=!0,this._fovLerp01=0,this._fovLerpStartValue=o.fov,this._fovLerpEndValue=e,typeof t=="number"?this._fovLerpDuration=t:this._fovLerpDuration=this.targetLerpDuration))}setLookTargetPosition(e=null,t=!1){this._controls&&e&&(e instanceof A&&(e=ee(e)),this._lookTargetEndPosition.copy(e),this._didSetTarget++,is&&(console.warn("OrbitControls: setLookTargetPosition",e,t),G.DrawWireSphere(this._lookTargetEndPosition,.2,16711680,2)),t===!0?this._controls.target.copy(this._lookTargetEndPosition):(this._lookTargetLerpActive=!0,this._lookTargetLerp01=0,this._lookTargetStartPosition.copy(this._controls.target),typeof t=="number"?this._lookTargetLerpDuration=t:this._lookTargetLerpDuration=this.targetLerpDuration))}get lookTargetLerpActive(){return this._lookTargetLerpActive}stopLookTargetLerp(){this._lookTargetLerpActive=!1}setLookTargetFromConstraint(e=0,t=1){var s,o;if(!this._controls||((s=this.lookAtConstraint)==null?void 0:s.enabled)===!1)return!1;const r=(o=this.lookAtConstraint)==null?void 0:o.sources;if(r&&r.length>0){const l=r[e];if(l)return l.getWorldPosition(this._lookTargetEndPosition),this.lerpLookTarget(this._lookTargetEndPosition,t),!0}return!1}lerpTarget(e,t){return this.lerpLookTarget(e,t)}lerpLookTarget(e,t){this._controls&&(t>=1?this._controls.target.copy(e):this._controls.target.lerp(e,t))}setTargetFromRaycast(e,t=!1){if(!this.controls)return!1;const s=e?this.context.physics.raycastFromRay(e):this.context.physics.raycast();for(const o of s)if(o.distance>0&&P.isActiveInHierarchy(o.object)){const r=Vf(o.object);if(r){const l=r.canvas;if(l!=null&&l.screenspace)break}return this.setLookTargetPosition(o.point,t),!0}return!1}fitCamera(e,t){var s,o;if(this.context.isInXR)return;let r;if(Array.isArray(e)?r=e:e&&"type"in e?r=e.children:e&&typeof e=="object"&&!(e instanceof A)&&!Array.isArray(e)&&(t=e,r=t.objects),r&&!Array.isArray(r)&&(r=r.children),(!Array.isArray(r)||r&&r.length<=0)&&(r=this.context.scene.children),!Array.isArray(r)||r.length<=0){console.warn("No objects to fit camera to...");return}const l=this._cameraObject,c=this._controls;if(!l||!c){console.warn("No camera or controls found to fit camera to objects...");return}t||(t={});const{immediate:h=!1,centerCamera:d="y",cameraNearFar:u="auto",fitOffset:p=1.1,fov:g=l?.fov}=t,f=new S,y=new S,v=ni(r,void 0,(o=(s=this._camera)==null?void 0:s.threeCamera)==null?void 0:o.layers),b=v.clone();l.updateMatrixWorld(),l.updateProjectionMatrix(),v.getCenter(y);const _=new S;if(v.getSize(_),v.applyMatrix4(l.matrixWorldInverse),v.getSize(f),v.setFromCenterAndSize(y,f),Number.isNaN(f.x)||Number.isNaN(f.y)||Number.isNaN(f.z)){console.warn("Camera fit size resultet in NaN",l,v,[...r]);return}if(f.length()<=1e-10){Fc&&console.warn("Camera fit size is zero",v,[...r]);return}const w=t.fov||l.fov,x=2*Math.atan(Math.tan(w*Math.PI/360/2)*l.aspect)/Math.PI*360,k=f.y/(2*Math.atan(Math.PI*w/360)),M=f.x/(2*Math.atan(Math.PI*x/360)),T=p*Math.max(k,M)+f.z/2;Fc&&console.log("Fit camera to objects",{fitHeightDistance:k,fitWidthDistance:M,distance:T,verticalFov:w,horizontalFov:x}),this.maxZoom=T*10,this.minZoom=T*.01;const D=.05,z=y.clone();if(z.y-=f.y*D,this.setLookTargetPosition(z,h),this.setFieldOfView(t.fov,h),u==null||u=="auto"){const F=P.findObjectOfType(en),I=F?F.radius:0,Y=Math.max(_.x,_.y,_.z,I);l.near=T/100,l.far=Y+T*10,F&&(this.maxZoom=Math.max(Math.min(this.maxZoom,I*.5),T))}const U=c.getDistance();U<this.minZoom&&(this.minZoom=U*.9),U>this.maxZoom&&(this.maxZoom=U*1.1),l.updateMatrixWorld(),l.updateProjectionMatrix();const E=ee(l),$=y.clone();$.sub(E),d==="y"&&($.y=0),$.normalize(),$.multiplyScalar(T),d==="y"&&($.y+=-D*4*T);let H=y.clone().sub($);l.parent&&(H=l.parent.worldToLocal(H)),this.setCameraTargetPosition(H,h),(Fc||t.debug)&&(G.DrawWireBox3(v,16777011,10),G.DrawWireBox3(b,65280,10),!this._haveAttachedKeyboardEvents&&Fc&&(this._haveAttachedKeyboardEvents=!0,document.body.addEventListener("keydown",F=>{if(F.code==="KeyF"){let I;this._cameraObject instanceof we&&(I=Math.random()*Math.random()*170+10),this.fitCamera({objects:r,fitOffset:p,immediate:!1,fov:I})}F.code==="KeyV"&&this._cameraObject instanceof we&&(this._cameraObject.fov=60)}))),this.onBeforeRender()}}Ue([m()],_e.prototype,"autoTarget"),Ue([m()],_e.prototype,"autoFit"),Ue([m()],_e.prototype,"enableRotate"),Ue([m()],_e.prototype,"autoRotate"),Ue([m()],_e.prototype,"autoRotateSpeed"),Ue([m()],_e.prototype,"minAzimuthAngle"),Ue([m()],_e.prototype,"maxAzimuthAngle"),Ue([m()],_e.prototype,"minPolarAngle"),Ue([m()],_e.prototype,"maxPolarAngle"),Ue([m()],_e.prototype,"enableKeys"),Ue([m()],_e.prototype,"enableDamping"),Ue([m()],_e.prototype,"dampingFactor"),Ue([m()],_e.prototype,"enableZoom"),Ue([m()],_e.prototype,"minZoom"),Ue([m()],_e.prototype,"maxZoom"),Ue([m()],_e.prototype,"zoomSpeed"),Ue([m()],_e.prototype,"enablePan"),Ue([m(Br)],_e.prototype,"lookAtConstraint"),Ue([m()],_e.prototype,"lookAtConstraint01"),Ue([m()],_e.prototype,"allowInterrupt"),Ue([m()],_e.prototype,"middleClickToFocus"),Ue([m()],_e.prototype,"doubleClickToFocus"),Ue([m()],_e.prototype,"clickBackgroundToFitScene"),Ue([m()],_e.prototype,"targetLerpDuration");var AT=Object.defineProperty,IT=Object.getOwnPropertyDescriptor,Kt=(n,e,t,s)=>{for(var o=s>1?void 0:s?IT(e,t):e,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=(s?l(e,t,o):l(o))||o);return s&&o&&AT(e,t,o),o},Ur=(n=>(n[n.None=0]="None",n[n.Skybox=1]="Skybox",n[n.SolidColor=2]="SolidColor",n[n.Uninitialized=4]="Uninitialized",n))(Ur||{});const Io=C("debugcam"),Mx=C("debugscreenpointtoray");var Lo;const Ut=(Lo=class extends j{constructor(){super(...arguments),a(this,"_nearClipPlane",.1),a(this,"_farClipPlane",1e3),a(this,"orthographic",!1),a(this,"orthographicSize",5),a(this,"ARBackgroundAlpha",0),a(this,"_cullingMask",4294967295),a(this,"_backgroundBlurriness"),a(this,"_backgroundIntensity"),a(this,"_backgroundRotation"),a(this,"_environmentIntensity"),a(this,"_targetTexture",null),a(this,"_backgroundColor"),a(this,"_fov"),a(this,"_cam",null),a(this,"_clearFlags",2),a(this,"_skybox"),a(this,"_frustum"),a(this,"_projScreenMatrix",new ne)}get isCamera(){return!0}get aspect(){return this._cam instanceof we?this._cam.aspect:this.context.domWidth/this.context.domHeight}set aspect(n){this._cam instanceof we&&this._cam.aspect!==n&&(this._cam.aspect=n,this._cam.updateProjectionMatrix())}get fieldOfView(){return this._cam instanceof we?this._cam.fov:this._fov}set fieldOfView(n){const e=this.fieldOfView!=n;if(this._fov=n,e&&this._cam&&this._cam instanceof we){if(this._fov===void 0){console.warn("Can not set undefined fov on PerspectiveCamera");return}this._cam.fov=this._fov,this._cam.updateProjectionMatrix()}}get nearClipPlane(){return this._nearClipPlane}set nearClipPlane(n){const e=this._nearClipPlane!=n;this._nearClipPlane=n,this._cam&&(e||this._cam.near!=n)&&(this._cam.near=n,this._cam.updateProjectionMatrix())}get farClipPlane(){return this._farClipPlane}set farClipPlane(n){const e=this._farClipPlane!=n;this._farClipPlane=n,this._cam&&(e||this._cam.far!=n)&&(this._cam.far=n,this._cam.updateProjectionMatrix())}applyClippingPlane(){this._cam&&(this._cam.near=this._nearClipPlane,this._cam.far=this._farClipPlane,this._cam.updateProjectionMatrix())}get clearFlags(){return this._clearFlags}set clearFlags(n){if(typeof n=="string")switch(n){case"skybox":n=1;break;case"solidcolor":n=2;break;default:n=0;break}n!==this._clearFlags&&(this._clearFlags=n,this.applyClearFlagsIfIsActiveCamera())}set cullingMask(n){this._cullingMask=n,this._cam&&(this._cam.layers.mask=n)}get cullingMask(){return this._cam?this._cam.layers.mask:this._cullingMask}set cullingLayer(n){this.cullingMask=(1<<n|0)>>>0}set backgroundBlurriness(n){n!==this._backgroundBlurriness&&(n===void 0?this._backgroundBlurriness=void 0:this._backgroundBlurriness=Math.min(Math.max(n,0),1),this.applyClearFlagsIfIsActiveCamera())}get backgroundBlurriness(){return this._backgroundBlurriness}set backgroundIntensity(n){n!==this._backgroundIntensity&&(n===void 0?this._backgroundIntensity=void 0:this._backgroundIntensity=Math.min(Math.max(n,0),10),this.applyClearFlagsIfIsActiveCamera())}get backgroundIntensity(){return this._backgroundIntensity}set backgroundRotation(n){n!==this._backgroundRotation&&(n===void 0?this._backgroundRotation=void 0:this._backgroundRotation=n,this.applyClearFlagsIfIsActiveCamera())}get backgroundRotation(){return this._backgroundRotation}set environmentIntensity(n){this._environmentIntensity=n}get environmentIntensity(){return this._environmentIntensity}get backgroundColor(){return this._backgroundColor??null}set backgroundColor(n){n&&(this._backgroundColor||(this._backgroundColor=new he(1,1,1,1)),this._backgroundColor.copy(n),(!("alpha"in n)||n.alpha===void 0)&&(this._backgroundColor.alpha=1),this.applyClearFlagsIfIsActiveCamera())}set targetTexture(n){this._targetTexture=n}get targetTexture(){return this._targetTexture}get cam(){return this.threeCamera}get threeCamera(){return this.activeAndEnabled&&this.buildCamera(),this._cam}screenPointToRay(n,e,t){const s=this.threeCamera,o=Lo._origin;o.set(n,e,-1),this.context.input.convertScreenspaceToRaycastSpace(o),Mx&&console.log("screenPointToRay",n.toFixed(2),e.toFixed(2),"now:",o.x.toFixed(2),o.y.toFixed(2),"isInXR:"+this.context.isInXR),o.z=-1,o.unproject(s);const r=Lo._direction.set(o.x,o.y,o.z),l=ee(s);return r.sub(l),r.normalize(),t?(t.set(l,r),t):new mo(l.clone(),r.clone())}getFrustum(){return this._frustum||(this._frustum=new Bv,this.updateFrustum()),this._frustum}updateFrustum(){this._frustum||(this._frustum=new Bv),this._frustum.setFromProjectionMatrix(this.getProjectionScreenMatrix(this._projScreenMatrix,!0),this.context.renderer.coordinateSystem)}getProjectionScreenMatrix(n,e){return e&&this._projScreenMatrix.multiplyMatrices(this.threeCamera.projectionMatrix,this.threeCamera.matrixWorldInverse),n===this._projScreenMatrix?n:n.copy(this._projScreenMatrix)}awake(){Mx&&window.addEventListener("pointerdown",n=>{const e=n.clientX,t=n.clientY;console.log("touch",e.toFixed(2),t.toFixed(2));const s=this.screenPointToRay(e,t),o="#"+Math.floor(Math.random()*16777215).toString(16);G.DrawRay(s.origin,s.direction,o,10)})}onEnable(){Io&&console.log(`Camera enabled: "${this.name}". ClearFlags=${Ur[this._clearFlags]}`,this),this.buildCamera(),(this.tag=="MainCamera"||!this.context.mainCameraComponent)&&(this.context.setCurrentCamera(this),jT(this)),this.applyClearFlagsIfIsActiveCamera({applySkybox:!0})}onDisable(){this.context.removeCamera(this)}onBeforeRender(){if(this._cam&&(this._frustum&&this.updateFrustum(),this._clearFlags===2&&this.applyClearFlagsIfIsActiveCamera(),this._targetTexture)){this.context.isManagedExternally&&(this._warnedAboutExternalRenderer||(this._warnedAboutExternalRenderer=!0,console.warn("Rendering with external renderer is not supported yet. This may not work or throw errors. Please remove the the target texture from your camera: "+this.name,this.targetTexture))),this.context.composer;const n=this.context.renderer;if(n){const e=this.context.mainCameraComponent;this.applyClearFlags(),this._targetTexture.render(this.context.scene,this._cam,n),e?.applyClearFlags()}}}buildCamera(){if(this._cam)return;const n=this.gameObject.isCamera;let e=null;if(n?(e=this.gameObject,e?.layers.enableAll(),e instanceof we&&(this._fov=e.fov)):e=this.gameObject.children[0],e&&e.isCamera)e instanceof we&&(this._fov&&(e.fov=this._fov),e.near=this._nearClipPlane,e.far=this._farClipPlane,e.updateProjectionMatrix());else if(!this.orthographic)e=new we(this.fieldOfView,window.innerWidth/window.innerHeight,this._nearClipPlane,this._farClipPlane),this.fieldOfView&&(e.fov=this.fieldOfView),this.gameObject.add(e);else{const t=this.orthographicSize*100;e=new pd(window.innerWidth/-t,window.innerWidth/t,window.innerHeight/t,window.innerHeight/-t,this._nearClipPlane,this._farClipPlane),this.gameObject.add(e)}this._cam=e,this._cam.layers.mask=this._cullingMask,this.tag=="MainCamera"&&this.context.setCurrentCamera(this)}applyClearFlagsIfIsActiveCamera(n){this.context.mainCameraComponent===this&&this.applyClearFlags(n)}applyClearFlags(n){var e;if(!this._cam){Io&&console.log("Camera does not exist (apply clear flags)");return}if(this.fieldOfView=this._fov,Io){const s=`[Camera] Apply ClearFlags: ${Ur[this._clearFlags]} - "${this.name}"`;console.debug(s)}const t=this.context.domElement.getAttribute("background-image")||this.context.domElement.getAttribute("background-color");switch(this._clearFlags){case 0:return;case 1:if(Lo.backgroundShouldBeTransparent(this.context)&&(!this.ARBackgroundAlpha||this.ARBackgroundAlpha<.001)){this.context.scene.background=null,this.context.renderer.setClearColor(0,0);return}(!this.scene.background||!this._skybox||n?.applySkybox===!0)&&this.applySceneSkybox(),this._backgroundBlurriness!==void 0&&!this.context.domElement.getAttribute("background-blurriness")?this.context.scene.backgroundBlurriness=this._backgroundBlurriness:Io&&console.warn(`Camera "${this.name}" has no background blurriness`),this._backgroundIntensity!==void 0&&!this.context.domElement.getAttribute("background-intensity")&&(this.context.scene.backgroundIntensity=this._backgroundIntensity),this._backgroundRotation!==void 0&&!this.context.domElement.getAttribute("background-rotation")?this.context.scene.backgroundRotation=this._backgroundRotation:Io&&console.warn(`Camera "${this.name}" has no background intensity`);break;case 2:if(this._backgroundColor&&!t){let s=this._backgroundColor.alpha;Lo.backgroundShouldBeTransparent(this.context)&&(s=this.ARBackgroundAlpha??0),this.context.scene.background=null,(e=this.context.xr)!=null&&e.isVR?this.context.renderer.setClearColor(Rb(this._backgroundColor).convertLinearToSRGB()):this.context.renderer.setClearColor(this._backgroundColor,s)}else this._backgroundColor||Io&&console.warn(`[Camera] has no background color "${this.name}" `);break;case 4:t||(this.context.scene.background=null,this.context.renderer.setClearColor(0,0));break}}applySceneSkybox(){this._skybox||(this._skybox=new LT(this)),this._skybox.apply()}static backgroundShouldBeTransparent(n){var e,t,s,o;const r=(e=n.renderer.xr)==null?void 0:e.getSession();if(!r)return!1;if(typeof r._transparent=="boolean")return r._transparent;const l=r.environmentBlendMode;Io&&De("Environment blend mode: "+l+" on "+navigator.userAgent);let c=l==="additive"||l==="alpha-blend";return n.isInAR&&l==="opaque"&&((t=navigator.userAgent)!=null&&t.includes("OculusBrowser")||(s=navigator.userAgent)!=null&&s.includes("Mozilla")&&(o=navigator.userAgent)!=null&&o.includes("Mobile WebXRViewer/v2"))&&(c=!0),r._transparent=c,c}},a(Lo,"_origin",new S),a(Lo,"_direction",new S),Lo);Kt([m()],Ut.prototype,"aspect",1),Kt([m()],Ut.prototype,"fieldOfView",1),Kt([m()],Ut.prototype,"nearClipPlane",1),Kt([m()],Ut.prototype,"farClipPlane",1),Kt([m()],Ut.prototype,"clearFlags",1),Kt([m()],Ut.prototype,"orthographic",2),Kt([m()],Ut.prototype,"orthographicSize",2),Kt([m()],Ut.prototype,"ARBackgroundAlpha",2),Kt([m()],Ut.prototype,"cullingMask",1),Kt([m()],Ut.prototype,"backgroundBlurriness",1),Kt([m()],Ut.prototype,"backgroundIntensity",1),Kt([m(Dt)],Ut.prototype,"backgroundRotation",1),Kt([m()],Ut.prototype,"environmentIntensity",1),Kt([m(he)],Ut.prototype,"backgroundColor",1),Kt([m(Ic)],Ut.prototype,"targetTexture",1);let hi=Ut;class LT{constructor(e){a(this,"_camera"),a(this,"_skybox"),this._camera=e}get context(){var e;return(e=this._camera)==null?void 0:e.context}apply(){var e;if(this._skybox=this.context.lightmaps.tryGetSkybox(this._camera.sourceId),!this._skybox)this._did_log_failed_to_find_skybox||(this._did_log_failed_to_find_skybox=!0,console.warn(`Camera "${this._camera.name}" has no skybox texture. ${this._camera.sourceId}`));else if(this.context.scene.background!==this._skybox){const t=this.context.domElement.getAttribute("background-image")||this.context.domElement.getAttribute("background-color")||this.context.domElement.getAttribute("skybox-image");Io&&console.debug(`[Camera] Apply Skybox ${(e=this._skybox)==null?void 0:e.name} ${t} - "${this._camera.name}"`),t!=null&&t.length||(this._skybox.mapping=kn,this.context.scene.background=this._skybox)}}}function jT(n){C("freecam")&&n.context.mainCameraComponent===n&&P.getOrAddComponent(n.gameObject,_e)}class Nn extends j{constructor(){super(...arguments),a(this,"_listener",null),a(this,"onInteraction",()=>{this.destroyed||this.listener==null||this.addListenerIfItExists()})}get listener(){return this._listener==null&&(this._listener=new YC),this._listener}onEnable(){Ln.registerWaitForInteraction(this.onInteraction),this.addListenerIfItExists()}onDisable(){Ln.unregisterWaitForInteraction(this.onInteraction),this.removeListenerIfItExists()}addListenerIfItExists(){const e=this._listener;if(!e||e!=null&&e.parent)return;const t=this.context.mainCameraComponent||P.getComponentInParent(this.gameObject,hi);t!=null&&t.threeCamera?t.threeCamera.add(e):this.gameObject.add(e),e.filter?(e.gain.connect(e.filter),e.filter.connect(e.context.destination)):e.gain.connect(e.context.destination)}removeListenerIfItExists(){const e=this._listener;e&&(e.removeFromParent(),e.filter&&e.filter.disconnect(),e.gain&&e.gain.disconnect())}}var DT=Object.defineProperty,BT=Object.getOwnPropertyDescriptor,Ps=(n,e,t,s)=>{for(var o=s>1?void 0:s?BT(e,t):e,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=(s?l(e,t,o):l(o))||o);return s&&o&&DT(e,t,o),o};const Et=C("debugaudio"),ss=class dr extends j{constructor(){super(...arguments),a(this,"clip",""),a(this,"playOnAwake",!1),a(this,"preload",!0),a(this,"playInBackground",!0),a(this,"_spatialBlend",0),a(this,"_minDistance",1),a(this,"_maxDistance",100),a(this,"_volume",1),a(this,"rollOffMode",0),a(this,"_loop",!1),a(this,"sound",null),a(this,"helper",null),a(this,"wasPlaying",!1),a(this,"audioLoader",null),a(this,"shouldPlay",!1),a(this,"_lastClipStartedLoading",null),a(this,"_audioElement",null),a(this,"onVisibilityChanged",()=>{switch(document.visibilityState){case"hidden":(this.playInBackground===!1||Q.isMobileDevice())&&(this.wasPlaying=this.isPlaying,this.isPlaying&&this.pause());break;case"visible":Et&&console.log("visible",this.enabled,this.playOnAwake,!this.isPlaying,dr.userInteractionRegistered,this.wasPlaying),this.enabled&&this.playOnAwake&&!this.isPlaying&&dr.userInteractionRegistered&&this.wasPlaying&&this.play();break}}),a(this,"onApplicationMuteChanged",()=>{var e,t;this.context.application.muted?(e=this.sound)==null||e.setVolume(0):(t=this.sound)==null||t.setVolume(this.volume)}),a(this,"createAudio",e=>{if(this.destroyed){Et&&console.warn("AudioSource destroyed, not creating audio",this.name);return}Et&&console.log("AudioBuffer finished loading",e);const t=this.Sound;if(!t){Et&&console.warn("Failed getting sound?",this.name);return}t.isPlaying&&t.stop(),e&&t.setBuffer(e),t.loop=this._loop,this.context.application.muted?t.setVolume(0):t.setVolume(this.volume),t.autoplay=this.shouldPlay&&dr.userInteractionRegistered,this.applySpatialDistanceSettings(),t.isPlaying&&t.stop(),dr.registerWaitForAllowAudio(this.__onAllowAudioCallback)}),a(this,"__onAllowAudioCallback",()=>{this.shouldPlay&&this.play()}),a(this,"_lastContextTime",0),a(this,"_hasEnded",!0),a(this,"_needUpdateSpatialDistanceSettings",!1)}static get userInteractionRegistered(){return Ln.userInteractionRegistered}static registerWaitForAllowAudio(e){Ln.registerWaitForInteraction(e)}get isPlaying(){var e;return((e=this.sound)==null?void 0:e.isPlaying)??!1}get duration(){var e,t;return(t=(e=this.sound)==null?void 0:e.buffer)==null?void 0:t.duration}get time01(){var e;const t=this.duration;return t&&this.sound?((e=this.sound)==null?void 0:e.context.currentTime)/t:0}set time01(e){const t=this.duration;t&&this.sound&&(this.time=e*t)}get time(){var e,t;return(e=this.sound)!=null&&e.source?((t=this.sound.source)==null?void 0:t.context.currentTime)-this._lastContextTime+this.sound.offset:0}set time(e){if(this.sound){if(e===this.sound.offset)return;const t=this.isPlaying;this.stop(),this.sound.offset=e,t&&this.play()}}get loop(){return this.sound&&(this._loop=this.sound.getLoop()),this._loop}set loop(e){this._loop=e,this.sound&&this.sound.setLoop(e)}get spatialBlend(){return this._spatialBlend}set spatialBlend(e){e!==this._spatialBlend&&(this._spatialBlend=e,this._needUpdateSpatialDistanceSettings=!0)}get minDistance(){return this._minDistance}set minDistance(e){this._minDistance!==e&&(this._minDistance=e,this._needUpdateSpatialDistanceSettings=!0)}get maxDistance(){return this._maxDistance}set maxDistance(e){this._maxDistance!==e&&(this._maxDistance=e,this._needUpdateSpatialDistanceSettings=!0)}get volume(){return this._volume}set volume(e){this._volume=e,this.sound&&!this.context.application.muted&&(Et&&console.log(this.name,"audio set volume",e),this.sound.setVolume(e))}set pitch(e){this.sound&&this.sound.setPlaybackRate(e)}get pitch(){return this.sound?this.sound.getPlaybackRate():1}get Sound(){var e;if(!this.sound&&dr.userInteractionRegistered){let t=this.gameObject.getComponent(Nn)??this.context.mainCamera.getComponent(Nn)??Sc(Nn,this.context,!1);!t&&this.context.mainCamera&&(t=this.context.mainCamera.addComponent(Nn)),t!=null&&t.listener?(this.sound=new KC(t.listener),(e=this.gameObject)==null||e.add(this.sound)):Et&&console.warn("No audio listener found in scene - can not play audio")}return this.sound}get ShouldPlay(){return this.shouldPlay}get audioContext(){var e;return(e=this.sound)==null?void 0:e.context}awake(){Et&&console.log("[AudioSource]",this),this.audioLoader=new Dm,this.playOnAwake&&(this.shouldPlay=!0),this.preload&&typeof this.clip=="string"&&this.audioLoader.load(this.clip,this.createAudio,()=>{},console.error)}onEnable(){this.sound&&this.gameObject.add(this.sound),dr.userInteractionRegistered?this.playOnAwake&&this.context.application.isVisible&&this.play():dr.registerWaitForAllowAudio(()=>{this.enabled&&!this.destroyed&&this.shouldPlay&&this.onNewClip(this.clip)}),globalThis.addEventListener("visibilitychange",this.onVisibilityChanged),this.context.application.addEventListener(kg.MuteChanged,this.onApplicationMuteChanged)}onDisable(){globalThis.removeEventListener("visibilitychange",this.onVisibilityChanged),this.context.application.removeEventListener(kg.MuteChanged,this.onApplicationMuteChanged),this.pause()}applySpatialDistanceSettings(){const e=this.sound;if(!e)return;this._needUpdateSpatialDistanceSettings=!1;const t=W.lerp(10*this._maxDistance/Math.max(1e-4,this.spatialBlend),this._minDistance,this.spatialBlend);switch(Et&&console.log(this.name,this._minDistance,this._maxDistance,this.spatialBlend,"Ref distance="+t),e.setRefDistance(t),e.setMaxDistance(Math.max(.01,this._maxDistance)),this.rollOffMode){case 0:e.setDistanceModel("exponential");break;case 1:e.setDistanceModel("linear");break;case 2:console.warn("Custom rolloff for AudioSource is not supported: "+this.name);break}this.spatialBlend>0?Et&&!this.helper&&(this.helper=new tO(e,e.getRefDistance()),e.add(this.helper)):this.helper&&this.helper.parent&&this.helper.removeFromParent()}async onNewClip(e){if(e&&(this.clip=e),typeof e=="string")if(Et&&console.log(e),e.endsWith(".mp3")||e.endsWith(".wav")){if(this.audioLoader||(this.audioLoader=new Dm),this.shouldPlay=!0,this._lastClipStartedLoading===e){Et&&console.log("Is currently loading:",this._lastClipStartedLoading,this);return}this._lastClipStartedLoading=e,Et&&console.log("load audio",e);const t=await this.audioLoader.loadAsync(e).catch(console.error);if(this.destroyed)return;this._lastClipStartedLoading===e&&(this._lastClipStartedLoading=null),t&&this.createAudio(t)}else console.warn("Unsupported audio clip type",e);else this.shouldPlay=!0,this.createAudio()}play(e=void 0){var t,s,o;!e&&this.clip&&(e=this.clip),e!==void 0&&typeof e!="string"&&!(e instanceof MediaStream)&&(B()&&console.warn("Called play on AudioSource with unknown argument type:",e+`
|
|
941
941
|
Using the assigned clip instead:`,this.clip),e=this.clip);let r=!this.sound||e&&e!==this.clip;if(typeof e=="string"&&!this.audioLoader&&(r=!0),(e instanceof MediaStream||typeof e=="string")&&(this.clip=e),r){this.shouldPlay=!0,this.onNewClip(e);return}if(this.shouldPlay=!0,this._hasEnded=!1,Et&&console.log("play",(t=this.sound)==null?void 0:t.getVolume(),this.sound),this.sound&&!this.sound.isPlaying){const l=this.context.application.muted;l&&this.sound.setVolume(0),(s=this.gameObject)==null||s.add(this.sound),this.clip instanceof MediaStream?(this.sound.setMediaStreamSource(this.clip),this._audioElement||(this._audioElement=document.createElement("audio"),this._audioElement.style.display="none"),this._audioElement.parentNode||(o=this.context.domElement.shadowRoot)==null||o.append(this._audioElement),this._audioElement.srcObject=this.clip,this._audioElement.autoplay=!1):(this._audioElement&&this._audioElement.remove(),this.sound.play(l?.1:0))}}pause(){var e,t;Et&&console.log("Pause",this),this._hasEnded=!0,this.shouldPlay=!1,this.sound&&this.sound.isPlaying&&this.sound.source&&(this._lastContextTime=(e=this.sound)==null?void 0:e.context.currentTime,this.sound.pause()),(t=this._audioElement)==null||t.remove()}stop(){var e,t;Et&&console.log("Pause",this),this._hasEnded=!0,this.shouldPlay=!1,this.sound&&this.sound.source&&(this._lastContextTime=(e=this.sound)==null?void 0:e.context.currentTime,Et&&console.log(this._lastContextTime),this.sound.stop()),(t=this._audioElement)==null||t.remove()}update(){this.helper&&(this.isPlaying&&this.helper.update(),this.helper.visible=this.isPlaying),this._needUpdateSpatialDistanceSettings&&this.applySpatialDistanceSettings(),this.sound&&!this.sound.isPlaying&&this.shouldPlay&&!this._hasEnded&&(this._hasEnded=!0,Et&&console.log("Audio clip ended",this.clip),this.dispatchEvent(new CustomEvent("ended",{detail:this})))}};Ps([m(URL)],ss.prototype,"clip",2),Ps([m()],ss.prototype,"playOnAwake",2),Ps([m()],ss.prototype,"preload",2),Ps([m()],ss.prototype,"playInBackground",2),Ps([m()],ss.prototype,"loop",1),Ps([m()],ss.prototype,"spatialBlend",1),Ps([m()],ss.prototype,"minDistance",1),Ps([m()],ss.prototype,"maxDistance",1),Ps([m()],ss.prototype,"volume",1),Ps([m()],ss.prototype,"pitch",1),Ps([m()],ss.prototype,"rollOffMode",2);let ns=ss;const FT=C("debugavatar"),Du=class wn extends j{constructor(){super(...arguments),a(this,"connectionId"),a(this,"avatar")}static getAvatar(e){return e>=0&&e<wn.instances.length?wn.instances[e]:null}static onAvatarMarkerCreated(e){return wn._onNewAvatarMarkerAdded.push(e),e}static onAvatarMarkerDestroyed(e){return wn._onAvatarMarkerDestroyed.push(e),e}awake(){wn.instances.push(this),FT&&console.log(this);for(const e of wn._onNewAvatarMarkerAdded)e({avatarMarker:this,gameObject:this.gameObject})}onDestroy(){wn.instances.splice(wn.instances.indexOf(this),1);for(const e of wn._onAvatarMarkerDestroyed)e({avatarMarker:this,gameObject:this.gameObject})}isLocalAvatar(){return this.connectionId===this.context.connection.connectionId}};a(Du,"instances",[]),a(Du,"_onNewAvatarMarkerAdded",[]),a(Du,"_onAvatarMarkerDestroyed",[]);let di=Du;class Wn{static Add(e,t,s=null){if(t){for(const o of this.Pois)if(o.obj===t)return;this.Pois.push({obj:t,avatar:s}),this.LastChangeTime=e.time.time}}static Remove(e,t){var s;if(t){for(const o of this.Pois)if(o.obj===t){this.Pois.splice(this.Pois.indexOf(o),1),this.LastChangeTime=e?.time.time??((s=J.Current)==null?void 0:s.time.time);return}}}}a(Wn,"Pois",[]),a(Wn,"LastChangeTime",0);class UT{constructor(){a(this,"guid"),a(this,"position",new S)}}class zc extends j{constructor(){super(...arguments),a(this,"target",null),a(this,"avatar",null),a(this,"_model",null),a(this,"_targetModel",new UT),a(this,"_currentTargetObject",null),a(this,"_lastUpdateTime",0),a(this,"_lookDuration",0),a(this,"_lastPoiChangedTime",0)}set controlledTarget(e){this.target=e;const t=R.get("MoveRandom");if(t&&this.target){const s=P.getComponent(this.target,t);s&&s.destroy()}}awake(){if(this.avatar=P.getComponentInParent(this.gameObject,di),this.avatar){const e=P.getComponentInParent(this.gameObject,di);this._model=new Ig(this.context.connection,this.guid),e!=null&&e.isLocalAvatar&&this._model.requestOwnership()}this.context.connection.beginListen("avatar-look-target-changed",e=>{var t;this.target&&e&&e.guid===((t=this.avatar)==null?void 0:t.guid)&<(this.target,e.position)})}update(){var e;if((!this.context.connection.isConnected||(e=this._model)!=null&&e.hasOwnership)&&(Wn.LastChangeTime!==this._lastPoiChangedTime&&(this._lastPoiChangedTime=Wn.LastChangeTime,this._lookDuration=0),this.selectTarget(),this._currentTargetObject&&this.context.time.frameCount%10===0&&this.target)){const t=ee(this._currentTargetObject);lt(this.target,t),this.context.connection.isConnected&&this.avatar&&(this.context.connection.send("avatar-look-target-changed",this._targetModel),this._targetModel.guid=this.avatar.guid,this._targetModel.position.copy(t))}}selectTarget(){if(this.context.time.time-this._lastUpdateTime>this._lookDuration){this._lastUpdateTime=this.context.time.time,this._lookDuration=Math.random()*.5+.2;const e=Wn.Pois;if(e.length>0){const t=e[Math.floor(Math.random()*e.length)];if(t&&t.obj){if(t.avatar&&t.avatar===this.avatar)return;this._currentTargetObject=t.obj}}}}}function Rx(n){const e=n;return!!(e.parser&&e.parser.json)}var Bu=(n=>(n[n.None=0]="None",n[n.DontExport=1]="DontExport",n))(Bu||{});function Tx(n){return n&&n.isComponent}const zT=Symbol("object"),qf=new ki(()=>new S,20);class Ex{constructor(e,t,s,o,r,l){a(this,"_point"),a(this,"_normal"),a(this,"_tangentVelocity"),a(this,"distance"),a(this,"impulse"),a(this,"friction"),this._point=e,this.distance=t,this._normal=s,this.impulse=o,this.friction=r,this._tangentVelocity=l}get point(){return qf.get().set(this._point.x,this._point.y,this._point.z)}get normal(){return qf.get().set(this._normal.x,this._normal.y,this._normal.z)}get tangentVelocity(){return qf.get().set(this._tangentVelocity.x,this._tangentVelocity.y,this._tangentVelocity.z)}}class Ax{constructor(e,t,s){a(this,"contacts"),a(this,"me"),a(this,"_collider"),a(this,"_gameObject"),this.me=e,this._collider=t,this._gameObject=t.gameObject,this.contacts=s}get collider(){return this._collider}get gameObject(){return this._gameObject}get rigidBody(){var e;return(e=this.collider)==null?void 0:e.attachedRigidbody}}class Ix{constructor(e,t){a(this,"object"),a(this,"collider"),this.object=e,this.collider=t}}const Ye=C("debugnetworkingstreams");var nn=(n=>(n.Connected="peer-user-connected",n.StreamReceived="receive-stream",n.StreamEnded="call-ended",n.Disconnected="peer-user-disconnected",n.UserJoined="user-joined",n))(nn||{});class Xf{constructor(e,t){a(this,"type","call-ended"),a(this,"userId"),a(this,"direction"),this.userId=e,this.direction=t}}class Lx{constructor(e,t,s){a(this,"type","receive-stream"),a(this,"userId"),a(this,"stream"),a(this,"target"),this.userId=e,this.stream=t,this.target=s}}class NT{constructor(e,t){a(this,"guid"),a(this,"peerId"),a(this,"dontSave",!0),this.guid=e.id,this.peerId=t}}var jx=(n=>(n.Incoming="incoming",n.Outgoing="outgoing",n))(jx||{});class WT extends Bm{constructor(e,t,s,o=null){super(),a(this,"peerId"),a(this,"userId"),a(this,"direction"),a(this,"call"),a(this,"_stream",null),a(this,"_isDisposed",!1),this.peerId=t.peer,this.userId=e,this.call=t,this.direction=s,this._stream=o,t.on("stream",r=>{if(Ye&&console.log("Receive stream",`
|
|
942
942
|
Audio:`,r.getAudioTracks(),`
|
|
943
943
|
Video:`,r.getVideoTracks()),this._stream=r,s==="incoming"){const l=new Lx(e,r,this);this.dispatchEvent(l)}}),t.on("close",()=>{this.dispatchEvent(new Xf(e,s))})}get stream(){return this._stream}close(){this._isDisposed||(this._isDisposed=!0,this.call.close(),on(this._stream))}get isOpen(){var e;return((e=this.call.peerConnection)==null?void 0:e.connectionState)==="connected"}get isOpening(){var e;return((e=this.call.peerConnection)==null?void 0:e.connectionState)==="connecting"}get isClosed(){return!this.isOpen||this._isDisposed}}function Dx(n){return n=n.replace("a=fmtp:111 minptime=10;useinbandfec=1","a=fmtp:111 ptime=5;useinbandfec=1;stereo=1;maxplaybackrate=48000;maxaveragebitrat=128000;sprop-stereo=1"),n}const Bx=class od extends Bm{constructor(e,t){super(),a(this,"updateCalls",()=>{var s;for(let o=this._incomingCalls.length-1;o>=0;o--){const r=this._incomingCalls[o];r.isClosed&&!r.isOpening&&this._incomingCalls.splice(o,1)}for(let o=this._outgoingCalls.length-1;o>=0;o--){const r=this._outgoingCalls[o];let l=!1;r.isClosed&&!r.isOpening&&((s=r.stream)!=null&&s.active?Ye&&console.warn("!!! Stream is still active, don't remove call",r.userId,"Your id: "+this.context.connection.connectionId):(Ye&&console.warn("!!! Remove closed call",r.userId),l=!0)),this.context.connection.userIsInRoom(r.userId)===!1&&(Ye&&console.warn("!!! User is not in room anymore, remove call",r.userId),l=!0),l&&(r.close(),this._outgoingCalls.splice(o,1))}}),a(this,"id"),a(this,"context"),a(this,"_incomingCalls",[]),a(this,"_outgoingCalls",[]),a(this,"_peer"),a(this,"_enabled",!1),a(this,"_enabledPeer",!1),a(this,"onConnectRoomFn",this.onConnectRoom.bind(this)),a(this,"onPeerConnect",s=>{if(Ye&&console.log("PEER opened as",s),s===null){console.error("Peer connection failed",s);return}this.context.connection.send("peer-user-connected",new NT(this,s))}),a(this,"onPeerClose",()=>{Ye&&console.log("PEER closed"),this.updateCalls()}),a(this,"onPeerDisconnected",()=>{Ye&&console.log("PEER disconnected"),this.updateCalls()}),a(this,"onPeerError",s=>{Ye&&console.error("PEER error",s)}),a(this,"onPeerReceivingCall",s=>{s.answer(void 0,{sdpTransform:o=>Dx(o)}),this.registerCall(s,"incoming",null)}),this.context=e,this.id=t,this.setupPeer(),navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia}static getOrCreate(e,t){if(od.instances.has(t))return od.instances.get(t);const s=new od(e,t);return od.instances.set(t,s),s}getMyPeerId(){if(this.context.connection.connectionId)return this.getPeerIdFromUserId(this.context.connection.connectionId)}getPeerIdFromUserId(e){return this.id+"-"+e}getUserIdFromPeerId(e){return e.substring(this.id.length+1)}makeCall(e,t){var s;if(!(t!=null&&t.id)){Ye?console.warn("Can not make a call: mediastream has no id or is undefined"):console.debug("Can not make a call: mediastream has no id or is undefined");return}const o={metadata:{userId:this.context.connection.connectionId,streamId:t.id},sdpTransform:l=>Dx(l)},r=(s=this._peer)==null?void 0:s.call(e,t,o);if(r){const l=this.registerCall(r,"outgoing",t);return Ye&&console.warn(`\u{1F4DE} CALL ${e}`,`
|
|
@@ -1318,9 +1318,9 @@ axisFormat %s
|
|
|
1318
1318
|
`;class t extends L.POSTPROCESSING.MODULE.Effect{constructor(){super("Sharpening",e,{vertexShader:n,blendFunction:L.POSTPROCESSING.MODULE.BlendFunction.NORMAL,uniforms:new Map([["amount",new Qi(1)],["radius",new Qi(1)]]),attributes:RO.CONVOLUTION})}}return t}var rI=Object.defineProperty,Ml=(n,e,t,s)=>{for(var o=void 0,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=l(e,t,o)||o);return o&&rI(e,t,o),o};class yn extends rt{constructor(){super(...arguments),a(this,"offset",new N(0)),a(this,"rotation",new N(0)),a(this,"focusArea",new N(.4)),a(this,"feather",new N(.3)),a(this,"kernelSize",new N(2)),a(this,"resolutionScale",new N(1/window.devicePixelRatio))}get typeName(){return"TiltShiftEffect"}init(){this.offset.defaultValue=0,this.rotation.defaultValue=0,this.focusArea.defaultValue=.4,this.feather.defaultValue=.3,this.kernelSize.defaultValue=L.POSTPROCESSING.MODULE.KernelSize.MEDIUM,this.resolutionScale.defaultValue=1/window.devicePixelRatio}onCreateEffect(){const e=new L.POSTPROCESSING.MODULE.TiltShiftEffect({kernelSize:L.POSTPROCESSING.MODULE.KernelSize.VERY_LARGE,offset:this.offset.value,rotation:this.rotation.value,focusArea:this.focusArea.value,feather:this.feather.value});return this.offset.onValueChanged=t=>e.offset=t,this.rotation.onValueChanged=t=>e.rotation=t,this.focusArea.onValueChanged=t=>e.focusArea=t,this.feather.onValueChanged=t=>e.feather=t,this.kernelSize.onValueChanged=t=>e.blurPass.kernelSize=t,this.resolutionScale.onValueChanged=t=>e.resolution.scale=t/window.devicePixelRatio,e}}Ml([m(N)],yn.prototype,"offset"),Ml([m(N)],yn.prototype,"rotation"),Ml([m(N)],yn.prototype,"focusArea"),Ml([m(N)],yn.prototype,"feather"),Ml([m(N)],yn.prototype,"kernelSize"),Ml([m(N)],yn.prototype,"resolutionScale"),us("TiltShiftEffect",yn);var aI=Object.defineProperty,zy=(n,e,t,s)=>{for(var o=void 0,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=l(e,t,o)||o);return o&&aI(e,t,o),o};class la extends rt{constructor(){super(...arguments),a(this,"color",new N({r:0,g:0,b:0,a:1})),a(this,"intensity",new N(0)),a(this,"center",new N({x:.5,y:.5}))}get typeName(){return"Vignette"}init(){this.color.defaultValue={r:0,g:0,b:0,a:1},this.intensity.defaultValue=0,this.center.defaultValue={x:.5,y:.5}}onCreateEffect(){const e=new L.POSTPROCESSING.MODULE.VignetteEffect;return this.intensity.onValueChanged=t=>{e.offset=t,this.updateDarkness(e)},this.color.onValueChanged=t=>{this.updateDarkness(e)},e}updateDarkness(e){const t=this.intensity.value;e.darkness=t}}zy([m(N)],la.prototype,"color"),zy([m(N)],la.prototype,"intensity"),zy([m(N)],la.prototype,"center"),us("Vignette",la),globalThis.NEEDLE_USE_POSTPROCESSING=globalThis.NEEDLE_USE_POSTPROCESSING!==void 0?globalThis.NEEDLE_USE_POSTPROCESSING:!0;const so=C("debugpost"),Ny=Symbol("needle:postprocessing-handler"),kh=Symbol("needle:previous-autoclear-state"),Mh=Symbol("needle:previous-tone-mapping");class Wy{constructor(e){a(this,"_composer",null),a(this,"_lastVolumeComponents"),a(this,"_effects",[]),a(this,"_isActive",!1),a(this,"context"),a(this,"_anyPassHasDepth",!1),a(this,"_anyPassHasNormal",!1),a(this,"_hasSmaaEffect",!1),a(this,"_customInputBuffer",null),a(this,"_customInputBufferId",0),a(this,"_multisampling",0),a(this,"_menuEntry",null),a(this,"_passIndices",null),this.context=e}getEffectIsActive(e){return e?this._isActive&&this._effects.some(t=>t.effect===e):!1}get isActive(){return this._isActive}get composer(){return this._composer}apply(e){return this._isActive=!0,this.onApply(this.context,e)}unapply(e=!0){var t,s;if(so&&console.log("Unapplying postprocessing effects"),this._isActive=!1,this._lastVolumeComponents){for(const r of this._lastVolumeComponents)r.unapply();this._lastVolumeComponents.length=0}const o=this.context;o[Ny]===this&&(delete o[Ny],typeof o.renderer[kh]=="boolean"&&(o.renderer.autoClear=o.renderer[kh]),typeof o.renderer[Mh]=="number"&&(o.renderer.toneMapping=o.renderer[Mh])),(t=this._composer)==null||t.removeAllPasses(),e&&((s=this._composer)==null||s.dispose()),o.composer===this._composer&&(o.composer=null)}dispose(){this.unapply(!0);for(const e of this._effects)e.effect.dispose();this._effects.length=0,this._composer=null}async onApply(e,t){if(!t)return;await Promise.all([L.POSTPROCESSING.load(),L.POSTPROCESSING_AO.load()]),e[Ny]=this,so&&console.log("Apply Postprocessing Effects",t),this._lastVolumeComponents=[...t],this._effects.length=0;const s={handler:this,components:this._lastVolumeComponents};for(let o=0;o<this._lastVolumeComponents.length;o++){const r=this._lastVolumeComponents[o];if(r.context=e,r.apply){if(r.active){let l=function(d,u){return u?(u instanceof L.POSTPROCESSING.MODULE.Effect||u instanceof L.POSTPROCESSING.MODULE.Pass||console.warn(`PostprocessingEffect ${d} created neither Effect nor Pass - this might be caused by a bundler error or false import. Below you find some possible solutions:
|
|
1319
1319
|
- If you create custom effect try creating it like this: 'new NEEDLE_ENGINE_MODULES.POSTPROCESSING.MODULE.Effect(...)' instead of 'new Effect(...)'`),!0):!1};if(!e.mainCameraComponent){console.error("No camera in scene found or available yet - can not create postprocessing effects");return}const c=r.apply(s);if(!c)continue;const h=r.typeName||r.constructor.name;if(Array.isArray(c))for(const d of c)l(h,d)&&this._effects.push({effect:d,typeName:r.typeName,priority:r.order});else{if(!l(h,c))continue;this._effects.push({effect:c,typeName:r.typeName,priority:r.order})}}}else r.active&&be("Volume component is not a VolumeComponent: "+r.__type)}this.applyEffects(e)}get anyPassHasDepth(){return this._anyPassHasDepth}get anyPassHasNormal(){return this._anyPassHasNormal}get hasSmaaEffect(){return this._hasSmaaEffect}set multisampling(e){this._multisampling=e}get multisampling(){return this._multisampling}applyEffects(e){var t;if(this._anyPassHasDepth=!1,this._anyPassHasNormal=!1,this._hasSmaaEffect=!1,this._effects.length<=0)return;const s=e.mainCameraComponent,o=e.renderer,r=e.scene,l=s.threeCamera;if(typeof o[kh]=="boolean"&&(o.autoClear=o[kh]),o[kh]=o.autoClear,typeof o[Mh]=="number"&&(o.toneMapping=o[Mh]),o[Mh]=o.toneMapping,o.toneMapping!=_d&&!this._effects.find(p=>p instanceof L.POSTPROCESSING.MODULE.ToneMappingEffect)){const p=new L.POSTPROCESSING.MODULE.ToneMappingEffect;p.name=`ToneMapping (${o.toneMapping})`,p.mode=Vp(o.toneMapping),this._effects.push({typeName:"ToneMapping",effect:p,priority:ft.ToneMapping})}this._composer||(this._composer=new L.POSTPROCESSING.MODULE.EffectComposer(o,{frameBufferType:Nm,stencilBuffer:!0})),e.composer&&e.composer!==this._composer&&console.warn("There's already an active EffectComposer in your scene: replacing it with a new one. This might cause unexpected behaviour. Make sure to only use one PostprocessingManager/Volume in your scene."),e.composer=this._composer;const c=e.composer;c.setMainCamera(l),c.setRenderer(o),c.setMainScene(r),c.autoRenderToScreen=!0,c.multisampling=0;for(const p of c.passes)p.dispose();c.removeAllPasses();const h=new L.POSTPROCESSING.MODULE.RenderPass(r,l);h.name="RenderPass",h.mainScene=r,c.addPass(h);const d=h.render;(t=this._customInputBuffer)==null||t.dispose(),this._customInputBuffer=null,h.render=(p,g,f,y,v)=>{var b;g&&(g.samples=0,f&&(f.samples=0),(!this._customInputBuffer||this._customInputBuffer.width!==g.width||this._customInputBuffer.height!==g.height||this._customInputBuffer.samples!==this._multisampling||this._customInputBuffer.texture.format!==g.texture.format||this._customInputBuffer.texture.type!==Nm)&&((b=this._customInputBuffer)==null||b.dispose(),this._customInputBuffer=new Vs(g.width,g.height,{format:g.texture.format,type:Nm,depthBuffer:g.depthBuffer,depthTexture:g.depthTexture?new Dv(g.width,g.height):void 0,stencilBuffer:g.stencilBuffer,samples:Math.max(0,this._multisampling),minFilter:g.texture.minFilter??Sd,magFilter:g.texture.magFilter??Sd,generateMipmaps:g.texture.generateMipmaps}),this._customInputBufferId++,this._customInputBuffer.texture.name=`CustomInputBuffer-${this._customInputBufferId}`,this._customInputBuffer.depthTexture&&g.depthTexture&&(this._customInputBuffer.depthTexture.format=g.depthTexture.format,this._customInputBuffer.depthTexture.type=g.depthTexture.type),this._customInputBuffer.samples>0&&(this._customInputBuffer.ignoreDepthForMultisampleCopy=!1),so&&console.warn(`[PostProcessing] Input buffer created with size ${this._customInputBuffer.width}x${this._customInputBuffer.height} and samples ${this._customInputBuffer.samples}`)),d.call(h,p,this._customInputBuffer,f,y,v),ec.blit(this._customInputBuffer.texture,g,{renderer:p,depthTexture:this._customInputBuffer.depthTexture,depthWrite:!0,depthTest:!0}))};try{T2(this._effects);let p=!1,g=null;for(let v=this._effects.length-1;v>=0;v--){const b=this._effects[v].effect;if(b instanceof L.POSTPROCESSING.MODULE.ToneMappingEffect){if(p){so&&console.warn(`[PostProcessing] Found multiple tonemapping effects in the scene: ${b.name} and ${g?.name}. Only the last one added will be used.`),this._effects.splice(v,1);continue}g=b,p=!0}}const f=[];let y=!1;for(let v=0;v<this._effects.length;v++){const b=this._effects[v].effect;if(b instanceof L.POSTPROCESSING.MODULE.SMAAEffect?this._hasSmaaEffect=!0:b instanceof L.POSTPROCESSING.MODULE.NormalPass&&(this._anyPassHasNormal=!0),!(b instanceof L.POSTPROCESSING.MODULE.ToneMappingEffect&&g!==b))if(b instanceof L.POSTPROCESSING.MODULE.Effect){const _=b.getAttributes(),w=L.POSTPROCESSING.MODULE.EffectAttribute.CONVOLUTION;_&w&&(so&&console.log("[PostProcessing] Convolution effect: "+b.name),y&&(so&&console.log("[PostProcessing] \u2192 Merging effects ["+f.map(x=>x.name).join(", ")+"]"),this.createPassForMergeableEffects(f,c,l,r)),y=!0),f.push(b)}else b instanceof L.POSTPROCESSING.MODULE.Pass?(y=!1,this.createPassForMergeableEffects(f,c,l,r),b.renderToScreen=!1,c.addPass(b)):(y=!1,this.createPassForMergeableEffects(f,c,l,r),c.addPass(b))}this.createPassForMergeableEffects(f,c,l,r)}catch(p){console.error("Error while applying postprocessing effects",p),c.passes.forEach(g=>g.dispose()),c.removeAllPasses()}let u=!1;for(let p=c.passes.length-1;p>=0;p--){const g=c.passes[p];let f=!1,y=!1;g.enabled&&(u||(f=!0,y=!0),u=!0),g.renderToScreen=y,g?.configuration!==void 0?g.configuration.gammaCorrection=f:"autosetGamma"in g&&(g.autosetGamma=f),this._anyPassHasDepth||(this._anyPassHasDepth=g.needsDepthTexture)}so&&console.log("[PostProcessing] Passes \u2192",[...c.passes],`
|
|
1320
1320
|
---------------------------------
|
|
1321
|
-
\u2022 `+c.passes.map(p=>p.name).join(`
|
|
1321
|
+
\u2022 `+c.passes.map(p=>p.name||p.constructor.name+"*").join(`
|
|
1322
1322
|
\u2022 `)+`
|
|
1323
|
-
`),so&&this._onCreateEffectsDebug(this._composer,l)}createPassForMergeableEffects(e,t,s,o){if(e.length>0){const r=new L.POSTPROCESSING.MODULE.EffectPass(s,...e);r.name=e.map(l=>l.name).join(", "),r.mainScene=o,r.enabled=!0,r.renderToScreen=!1,t.addPass(r),e.length=0}}_onCreateEffectsDebug(e,t){if(so==="passes"){const s=new L.POSTPROCESSING.MODULE.DepthEffect({blendFunction:L.POSTPROCESSING.MODULE.BlendFunction.NORMAL,inverted:!0});s.name="Depth Effect";const o=new L.POSTPROCESSING.MODULE.EffectPass(t,s);if(o.name="Depth Effect Pass",o.enabled=!1,e.passes.push(o),this._passIndices!==null){const l=[e.passes[0]];this._passIndices.length>0&&l.push(...this._passIndices.filter(c=>c!==0).map(c=>e.passes[c]).filter(c=>c)),l.length>0&&console.log("[PostProcessing] Passes (selected) \u2192",l),e.passes.length=0;for(const c of l)c.enabled=!0,c.renderToScreen=!1,e.addPass(c)}const r=this.context.menu;if(r&&this._passIndices===null){this._menuEntry&&this._menuEntry.remove();const l=document.createElement("select");l.multiple=!0;const c=document.createElement("option");c.innerText="Final Output",c.value="-1",l.appendChild(c);for(const h of e.passes){const d=document.createElement("option");d.innerText=h.name,d.value=`${e.passes.indexOf(h)}`,d.title=h.name,l.appendChild(d)}r.appendChild(l),this._menuEntry=l,l.addEventListener("change",()=>{const h=Array.from(l.selectedOptions).map(d=>parseInt(d.value));h.length===1&&h[0]===-1?this._passIndices=null:this._passIndices=h,this.applyEffects(this.context)})}}}}var lI=Object.defineProperty,bS=(n,e,t,s)=>{for(var o=void 0,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=l(e,t,o)||o);return o&&lI(e,t,o),o};const ca=C("debugpost");class Rl extends j{constructor(){super(...arguments),a(this,"sharedProfile"),a(this,"multisampling","auto"),a(this,"_postprocessing"),a(this,"_activeEffects",[]),a(this,"_effects",[]),a(this,"_componentEnabledTime",-1),a(this,"_multisampleAutoChangeTime",0),a(this,"_multisampleAutoDecreaseTime",0),a(this,"_lastApplyTime"),a(this,"_rapidApplyCount",0),a(this,"_isDirty",!1),a(this,"_modificationQueue"),a(this,"_recreateId",-1)}get isPostProcessingManager(){return!0}get effects(){return this._activeEffects}get dirty(){return this._isDirty}set dirty(e){this._isDirty=e}addEffect(e){let t=e;return t instanceof rt||(t=new Sh(t)),t.gameObject===void 0&&this.gameObject.addComponent(t),this._effects.includes(t)||(this._effects.push(t),this._isDirty=!0),e}removeEffect(e){var t,s,o,r;let l=-1;if(e instanceof rt?l=this._effects.indexOf(e):l=this._effects.findIndex(c=>c instanceof Sh&&c.effect===e),l!==-1)return this._effects.splice(l,1),this._isDirty=!0,e;if(e instanceof rt){const c=(s=(t=this.sharedProfile)==null?void 0:t.components)==null?void 0:s.indexOf(e);c!==void 0&&c!==-1&&(this._isDirty=!0,(r=(o=this.sharedProfile)==null?void 0:o.components)==null||r.splice(c,1))}return e}markDirty(){this._isDirty=!0}awake(){var e;ca&&(console.log("PostprocessingManager Awake",this),console.log("Press P to toggle post processing"),window.addEventListener("keydown",t=>{t.key==="p"&&(this.enabled=!this.enabled,De("Toggle PostProcessing "+this.name+": Enabled="+this.enabled),this.markDirty())})),(e=this.sharedProfile)==null||e.__init(this)}onEnable(){this._componentEnabledTime=this.context.time.realtimeSinceStartup,this._isDirty=!0}onDisable(){var e;(e=this._postprocessing)==null||e.unapply(),this._isDirty=!1}onBeforeRender(){if(!this.context.isInXR&&(this.context.mainCamera&&this._isDirty&&this.apply(),this.context.composer&&this._postprocessing&&this._postprocessing.composer===this.context.composer)){if(this.context.renderer.getContext().isContextLost()&&this.context.renderer.forceContextRestore(),this.context.composer.getRenderer()!==this.context.renderer&&this.context.composer.setRenderer(this.context.renderer),this.context.composer.setMainScene(this.context.scene),this.multisampling==="auto")if(this._postprocessing&&this._postprocessing.hasSmaaEffect)this._postprocessing.multisampling!==0&&(this._postprocessing.multisampling=0,(ca||B())&&console.log(`[PostProcessing] multisampling is disabled because it's set to 'auto' on your PostprocessingManager/Volume component that also has an SMAA effect.
|
|
1323
|
+
`),so&&this._onCreateEffectsDebug(this._composer,l)}createPassForMergeableEffects(e,t,s,o){if(e.length>0){const r=new L.POSTPROCESSING.MODULE.EffectPass(s,...e);r.name=e.map(l=>l.name).join(", "),r.mainScene=o,r.enabled=!0,r.renderToScreen=!1,t.addPass(r),e.length=0}}_onCreateEffectsDebug(e,t){if(so==="passes"){const s=new L.POSTPROCESSING.MODULE.DepthEffect({blendFunction:L.POSTPROCESSING.MODULE.BlendFunction.NORMAL,inverted:!0});s.name="Depth Effect";const o=new L.POSTPROCESSING.MODULE.EffectPass(t,s);if(o.name="Depth Effect Pass",o.enabled=!1,e.passes.push(o),this._passIndices!==null){const l=[e.passes[0]];this._passIndices.length>0&&l.push(...this._passIndices.filter(c=>c!==0).map(c=>e.passes[c]).filter(c=>c)),l.length>0&&console.log("[PostProcessing] Passes (selected) \u2192",l),e.passes.length=0;for(const c of l)c.enabled=!0,c.renderToScreen=!1,e.addPass(c)}const r=this.context.menu;if(r&&this._passIndices===null){this._menuEntry&&this._menuEntry.remove();const l=document.createElement("select");l.multiple=!0;const c=document.createElement("option");c.innerText="Final Output",c.value="-1",l.appendChild(c);for(const h of e.passes){const d=document.createElement("option");d.innerText=h.name,d.value=`${e.passes.indexOf(h)}`,d.title=h.name,l.appendChild(d)}r.appendChild(l),this._menuEntry=l,l.addEventListener("change",()=>{const h=Array.from(l.selectedOptions).map(d=>parseInt(d.value));h.length===1&&h[0]===-1?this._passIndices=null:this._passIndices=h,this.applyEffects(this.context)})}}}}var lI=Object.defineProperty,bS=(n,e,t,s)=>{for(var o=void 0,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=l(e,t,o)||o);return o&&lI(e,t,o),o};const ca=C("debugpost");class Rl extends j{constructor(){super(...arguments),a(this,"sharedProfile"),a(this,"multisampling","auto"),a(this,"_postprocessing"),a(this,"_activeEffects",[]),a(this,"_effects",[]),a(this,"_componentEnabledTime",-1),a(this,"_multisampleAutoChangeTime",0),a(this,"_multisampleAutoDecreaseTime",0),a(this,"_lastApplyTime"),a(this,"_rapidApplyCount",0),a(this,"_isDirty",!1),a(this,"_modificationQueue"),a(this,"_recreateId",-1)}get isPostProcessingManager(){return!0}get effects(){return this._activeEffects}get dirty(){return this._isDirty}set dirty(e){this._isDirty=e}addEffect(e){let t=e;return t instanceof rt||(t=new Sh(t),typeof e.order=="number"&&(t.order=e.order)),t.gameObject===void 0&&this.gameObject.addComponent(t),this._effects.includes(t)||(this._effects.push(t),this._isDirty=!0),e}removeEffect(e){var t,s,o,r;let l=-1;if(e instanceof rt?l=this._effects.indexOf(e):l=this._effects.findIndex(c=>c instanceof Sh&&c.effect===e),l!==-1)return this._effects.splice(l,1),this._isDirty=!0,e;if(e instanceof rt){const c=(s=(t=this.sharedProfile)==null?void 0:t.components)==null?void 0:s.indexOf(e);c!==void 0&&c!==-1&&(this._isDirty=!0,(r=(o=this.sharedProfile)==null?void 0:o.components)==null||r.splice(c,1))}return e}markDirty(){this._isDirty=!0}awake(){var e;ca&&(console.log("PostprocessingManager Awake",this),console.log("Press P to toggle post processing"),window.addEventListener("keydown",t=>{t.key==="p"&&(this.enabled=!this.enabled,De("Toggle PostProcessing "+this.name+": Enabled="+this.enabled),this.markDirty())})),(e=this.sharedProfile)==null||e.__init(this)}onEnable(){this._componentEnabledTime=this.context.time.realtimeSinceStartup,this._isDirty=!0}onDisable(){var e;(e=this._postprocessing)==null||e.unapply(),this._isDirty=!1}onBeforeRender(){if(!this.context.isInXR&&(this.context.mainCamera&&this._isDirty&&this.apply(),this.context.composer&&this._postprocessing&&this._postprocessing.composer===this.context.composer)){if(this.context.renderer.getContext().isContextLost()&&this.context.renderer.forceContextRestore(),this.context.composer.getRenderer()!==this.context.renderer&&this.context.composer.setRenderer(this.context.renderer),this.context.composer.setMainScene(this.context.scene),this.multisampling==="auto")if(this._postprocessing&&this._postprocessing.hasSmaaEffect)this._postprocessing.multisampling!==0&&(this._postprocessing.multisampling=0,(ca||B())&&console.log(`[PostProcessing] multisampling is disabled because it's set to 'auto' on your PostprocessingManager/Volume component that also has an SMAA effect.
|
|
1324
1324
|
|
|
1325
1325
|
If you need multisampling consider changing 'auto' to a fixed value (e.g. 4).`));else{const e=this.context.time.realtimeSinceStartup-this._multisampleAutoChangeTime;if(this.context.time.realtimeSinceStartup-this._componentEnabledTime>2&&e>.5){const t=this._postprocessing.multisampling;if(this._postprocessing.multisampling>0&&this.context.time.smoothedFps<=50){this._multisampleAutoChangeTime=this.context.time.realtimeSinceStartup,this._multisampleAutoDecreaseTime=this.context.time.realtimeSinceStartup;let s=this._postprocessing.multisampling*.5;s=Math.floor(s),s!=this._postprocessing.multisampling&&(this._postprocessing.multisampling=s),ca&&console.debug(`[PostProcessing] Reduced multisampling from ${t} to ${this._postprocessing.multisampling}`)}else if(e>1&&this.context.time.smoothedFps>=59&&this._postprocessing.multisampling<this.context.renderer.capabilities.maxSamples&&this.context.time.realtimeSinceStartup-this._multisampleAutoDecreaseTime>10){this._multisampleAutoChangeTime=this.context.time.realtimeSinceStartup;let s=this._postprocessing.multisampling<=0?1:this._postprocessing.multisampling*2;s=Math.floor(s),s!==this._postprocessing.multisampling&&(this._postprocessing.multisampling=s),ca&&console.debug(`[PostProcessing] Increased multisampling from ${t} to ${this._postprocessing.multisampling}`)}}}else{const e=Math.max(0,Math.min(this.multisampling,this.context.renderer.capabilities.maxSamples));e!==this._postprocessing.multisampling&&(this._postprocessing.multisampling=e)}if(this.context.mainCamera){const e=this.context.composer.passes;for(const t of e)if(t.mainCamera&&t.mainCamera!==this.context.mainCamera){this.context.composer.setMainCamera(this.context.mainCamera);break}}}}onDestroy(){var e;(e=this._postprocessing)==null||e.dispose()}apply(){var e,t,s;if(ca&&console.log(`Apply PostProcessing "${this.name||"unnamed"}"`),B()&&(this._lastApplyTime!==void 0&&Date.now()-this._lastApplyTime<100&&(this._rapidApplyCount++,this._rapidApplyCount===5&&console.warn("Detected rapid post processing modifications - this might be a bug",this)),this._lastApplyTime=Date.now()),this._isDirty=!1,this._activeEffects.length=0,(e=this.sharedProfile)!=null&&e.components){const o=this.sharedProfile.components;for(const r of o)r.active&&r.enabled&&!this._activeEffects.includes(r)&&this._activeEffects.push(r)}for(const o of this._effects)o.active&&o.enabled&&!this._activeEffects.includes(o)&&this._activeEffects.push(o);this._activeEffects.length>0?(this._postprocessing||(this._postprocessing=new Wy(this.context)),(t=this._postprocessing.apply(this._activeEffects))==null||t.then(()=>{this.activeAndEnabled&&(this._applyPostQueue(),this._postprocessing?(this.multisampling==="auto"?this._postprocessing.multisampling=Q.isMobileDevice()?2:4:this._postprocessing.multisampling=Math.max(0,Math.min(this.multisampling,this.context.renderer.capabilities.maxSamples)),ca&&console.debug(`[PostProcessing] Set multisampling to ${this._postprocessing.multisampling} (Is Mobile: ${Q.isMobileDevice()})`)):ca&&console.warn("[PostProcessing] No composer found"))})):(s=this._postprocessing)==null||s.unapply(!1)}_applyPostQueue(){if(this._modificationQueue){for(const e of this._modificationQueue.values())this.onEditorModification(e);this._modificationQueue.clear()}}onEditorModification(e){var t,s;if(e.propertyName.startsWith("postprocessing.")){if(!this._postprocessing)return this._modificationQueue||(this._modificationQueue=new Map),this._modificationQueue.set(e.propertyName,e),!0;if(!((t=this._activeEffects)!=null&&t.length))return;const o=e.propertyName.split(".");if(o.length===3||o.length===4){const r=o[1],l=o[2];for(const c of this._activeEffects)if(((s=c.typeName)==null?void 0:s.toLowerCase())===r.toLowerCase()){if(l==="active"){c.active=e.value,this.scheduleRecreate();return}if(!Hp.has(r)){const h=new Array;Hp.set(r,h);const d=Object.keys(c);for(const u of d)c[u]instanceof N&&h.push(u)}if(Hp.has(r)){const h=l.toLowerCase(),d=Hp.get(r);for(const u of d)if(u.toLowerCase()===h){const p=c[u];p instanceof N&&(o.length===4&&o[3]==="active"?(p.overrideState=e.value,this.scheduleRecreate()):p&&p.value!==void 0&&(p.value=e.value));return}}console.warn("Unknown modification",l);return}}return!0}return!1}scheduleRecreate(){const e=++this._recreateId;setTimeout(()=>{e===this._recreateId&&(this.onDisable(),this.onEnable())},200)}}bS([jr(Up)],Rl.prototype,"sharedProfile"),bS([jr()],Rl.prototype,"multisampling");const Hp=new Map;M2(Rl);async function Vy(n){const{NeedleEngineWebComponent:e}=await Promise.resolve().then(()=>FL);e.observedAttributes.includes(n)||e.observedAttributes.push(n)}var cI=Object.defineProperty,Pt=(n,e,t,s)=>{for(var o=void 0,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=l(e,t,o)||o);return o&&cI(e,t,o),o};const Ht=C("debugsceneswitcher"),hI=C("sceneswitcher:clearscene"),Gp="scene";Vy(Gp);const or=Promise.resolve(!1);class Ze extends j{constructor(){super(...arguments),a(this,"autoLoadFirstScene",!0),a(this,"scenes",[]),a(this,"loadingScene"),a(this,"queryParameterName","scene"),a(this,"useSceneName",!0),a(this,"clamp",!0),a(this,"useHistory",!0),a(this,"useKeyboard",!0),a(this,"useSwipe",!0),a(this,"useSceneLighting",!0),a(this,"useSceneBackground",!0),a(this,"preloadNext",1),a(this,"preloadPrevious",1),a(this,"preloadConcurrent",2),a(this,"createMenuButtons",!1),a(this,"sceneLoadingStart",new xe),a(this,"sceneLoadingProgress",new xe),a(this,"sceneLoaded",new xe),a(this,"_currentIndex",-1),a(this,"_currentScene"),a(this,"_engineElementOverserver"),a(this,"_preloadScheduler"),a(this,"_menuButtons"),a(this,"onPopState",async e=>{if(!this.useHistory)return;const t=this.useHistory;try{this.useHistory=!1;let s=!1;if(this.queryParameterName&&(s=await this.tryLoadFromQueryParam()),!s){const o=e?.state;if(o&&o.startsWith(this.guid)){const r=o.substr(this.guid.length+2);Ht&&console.log("PopState",r),await this.trySelectSceneFromValue(r)}}}finally{this.useHistory=t}}),a(this,"normalizedSwipeThresholdX",.1),a(this,"_didSwipe",!1),a(this,"onInputPointerMove",e=>{if(this.useSwipe&&!this._didSwipe&&e.button===0&&e.pointerType==="touch"&&this.context.input.getPointerPressedCount()===1){const t=this.context.input.getPointerPositionDelta(e.button);if(t){const s=t.x/this.context.domWidth;s>=this.normalizedSwipeThresholdX?(this._didSwipe=!0,this.selectPrev()):s<=-this.normalizedSwipeThresholdX&&(this._didSwipe=!0,this.selectNext())}}}),a(this,"onInputPointerUp",e=>{e.button===0&&(this._didSwipe=!1)}),a(this,"onInputKeyDown",e=>{if(!this.useKeyboard||!this.scenes)return;const t=e.key.toLowerCase();if(!t)return;const s=parseInt(t)-1;if(s>=0){this.trySelectSceneFromValue(s);return}switch(t){case"arrowright":case"d":this.selectNext();break;case"arrowleft":case"a":this.selectPrev();break}}),a(this,"__lastSwitchScene"),a(this,"__lastSwitchScenePromise"),a(this,"_currentlyLoadingScene"),a(this,"_lastLoadingScene"),a(this,"_loadingScenePromise"),a(this,"_isCurrentlyLoading",!1),a(this,"_currentLoadingProgress")}get currentIndex(){return this._currentIndex}get currentLoadingProgress(){return this._currentLoadingProgress}get currentlyLoadingScene(){return this._currentlyLoadingScene}get currentlyLoadedScene(){return this._currentScene}awake(){this.scenes===void 0&&(this.scenes=[]);for(const e of this.scenes)e&&!e.hasUrl&&e.asset instanceof A?P.remove(e.asset):e instanceof A&&P.remove(e);Ht&&console.log("SceneSwitcher",this)}async onEnable(){if(globalThis.addEventListener("popstate",this.onPopState),this.context.input.addEventListener(Be.KeyDown,this.onInputKeyDown),this.context.input.addEventListener(Be.PointerMove,this.onInputPointerMove),this.context.input.addEventListener(Be.PointerUp,this.onInputPointerUp),this._engineElementOverserver||(this._engineElementOverserver=new MutationObserver(e=>{for(const t of e)if(t.type==="attributes"&&t.attributeName===Gp){const s=this.context.domElement.getAttribute(Gp);s!==null&&this.trySelectSceneFromValue(s)}})),this._engineElementOverserver.observe(this.context.domElement,{attributes:!0}),this._preloadScheduler||(this._preloadScheduler=new dI(this)),this._preloadScheduler.maxLoadAhead=this.preloadNext,this._preloadScheduler.maxLoadBehind=this.preloadPrevious,this._preloadScheduler.maxConcurrent=this.preloadConcurrent,this._preloadScheduler.begin(2e3),this.autoLoadFirstScene&&this._currentIndex===-1&&!await this.tryLoadFromQueryParam()){const e=this.context.domElement.getAttribute(Gp);try{(e===null||!await this.trySelectSceneFromValue(e))&&this._currentIndex===-1&&this.select(0)}finally{}}this.createMenuButtons&&(this._menuButtons??(this._menuButtons=[]),this._menuButtons.push(this.context.menu.appendChild({label:"Previous",icon:"arrow_back_ios",onClick:()=>this.selectPrev(),priority:-1005,class:"row2"})),this._menuButtons.push(this.context.menu.appendChild({label:"Next",icon:"arrow_forward_ios",iconSide:"right",onClick:()=>this.selectNext(),priority:-1e3,class:"row2"})))}onDisable(){var e;if(globalThis.removeEventListener("popstate",this.onPopState),this.context.input.removeEventListener(Be.KeyDown,this.onInputKeyDown),this.context.input.removeEventListener(Be.PointerMove,this.onInputPointerMove),this.context.input.removeEventListener(Be.PointerUp,this.onInputPointerUp),(e=this._preloadScheduler)==null||e.stop(),this._menuButtons){for(const t of this._menuButtons)t.remove();this._menuButtons=void 0}}addScene(e){if(typeof e=="string"){let t=this.context.addressables.findAssetReference(e);return t||(t=new ce(e),this.context.addressables.registerAssetReference(t)),this.scenes.push(t),t}return this.scenes.push(e),e}selectNext(){return this.select(this._currentIndex+1)}selectPrev(){return this.select(this._currentIndex-1)}select(e){var t,s,o;if(Ht&&console.log("select",e),typeof e=="object"&&console.warn('Switching to "'+e+'" might not work. Please either use an index or a AssetReference (not a scene reference)'),typeof e=="string"){const l=(t=this.scenes)==null?void 0:t.find(c=>c.url===e);if(!l){const c=ce.getOrCreate(this.sourceId??"",e,this.context);return this.switchScene(c)}if(l)e=(s=this.scenes)==null?void 0:s.indexOf(l);else return or}if(!((o=this.scenes)!=null&&o.length))return or;if(e<0){if(this.clamp)return or;e=this.scenes.length-1}else if(e>=this.scenes.length){if(this.clamp)return or;e=0}const r=this.scenes[e];return this.switchScene(r)}unload(){return this.__lastSwitchScene=void 0,this.__lastSwitchScenePromise=void 0,this.__unloadCurrentScene()}async reload(){if(this.__lastSwitchScene){const e=this.__lastSwitchScene;return this.__lastSwitchScene=void 0,this.switchScene(e)}return!1}async switchScene(e){var t;if(!(e instanceof ce)){const s=typeof e;if(s==="string")return this.select(e);if(s==="number")return this.select(e);if(e&&e instanceof A){const o=(t=this.scenes)==null?void 0:t.indexOf(e);e=new ce(e.name,void 0,e),o>=0&&(this.scenes[o]=e)}else return console.warn(`[SceneSwitcher] Can't switch to scene of type ${s}`),!1}return e.url===this.sourceId?(console.warn("[SceneSwitcher] Can't load own scene - prevent recursive loading",this.sourceId),!1):this.__lastSwitchScene===e&&this.__lastSwitchScenePromise?this.__lastSwitchScenePromise:(this.__lastSwitchScene=e,this.__lastSwitchScenePromise=this.__internalSwitchScene(e),await this.__lastSwitchScenePromise)}async __unloadCurrentScene(){const e=this._currentScene;if(this._currentScene=void 0,e){Ht&&console.log("UNLOAD",e.url,"HasURL?: "+e.hasUrl);const t=this.tryGetSceneEventListener(e.asset);if(t!=null&&t.sceneClosing){const s=t.sceneClosing();s instanceof Promise&&await s}e.hasUrl?e.unload():e.asset instanceof A&&P.remove(e.asset)}}async __internalSwitchScene(e){var t,s,o,r,l;await this.__unloadCurrentScene();const c=this._currentIndex=((t=this.scenes)==null?void 0:t.indexOf(e))??-1;try{this._currentlyLoadingScene=e,this._currentLoadingProgress=new ProgressEvent("progress",{loaded:0,total:1});const h=new CustomEvent("loadscene-start",{detail:{scene:e,switcher:this,index:c}});this.dispatchEvent(h),(s=this.sceneLoadingStart)==null||s.invoke(h.detail),await this.onStartLoading(),await e.loadAssetAsync((u,p)=>{var g;if(Ht){const f=p.loaded/p.total,y="["+"=".repeat(Math.floor(f*20))+"-".repeat(20-Math.floor(f*20))+"]";console.debug(`[SceneSwitcher] Download ${(f*100).toFixed(1)} % ${y}`,e.url)}this._currentLoadingProgress=p,this.dispatchEvent(p),(g=this.sceneLoadingProgress)==null||g.invoke(p)}).catch(console.error),await this.onEndLoading();const d=new CustomEvent("loadscene-finished",{detail:{scene:e,switcher:this,index:c}});if(this.dispatchEvent(d),this._currentLoadingProgress=void 0,this._currentlyLoadingScene=void 0,d.defaultPrevented)return Ht&&console.warn("Adding loaded scene prevented:",e,d),!1;if(!e.asset)return Ht&&console.warn("Failed loading scene:",e),!1;if(this._currentIndex===c){if(Ht&&console.log("ADD",e.url),this._currentScene=e,hI){const g=((o=this.context.mainCameraComponent)==null?void 0:o.gameObject)||this.context.mainCamera;g?.removeFromParent();const f=this.gameObject.removeFromParent();Ai(this.context.scene,!0,!0),this.context.scene=new Si,this.context.scene.add(f),g&&this.context.scene.add(g)}if(P.add(e.asset,this.gameObject),this.useSceneLighting&&this.context.sceneLighting.enable(e),this.useSceneBackground){const g=this.context.lightmaps.tryGetSkybox(e.url);g?(g.mapping=kn,this.context.scene.background=g):Ht&&console.warn("SceneSwitcher: Can't find skybox for scene "+e.url)}if(this.useHistory&&c>=0){let g=c.toString();if(this.useSceneName&&(e instanceof A?g=e.name:e.url&&(g=_S(e.url))),(r=this.queryParameterName)!=null&&r.length)ql(this.queryParameterName,g,this.useHistory);else{const f=history.state,y=this.guid+"::"+c;f!==y&&history.pushState(y,"unused",location.href)}}const u=this.tryGetSceneEventListener(e.asset);if(u!=null&&u.sceneOpened){const g=u.sceneOpened(this);g instanceof Promise&&await g}const p=new CustomEvent("scene-opened",{detail:{scene:e,switcher:this,index:c}});return this.dispatchEvent(p),(l=this.sceneLoaded)==null||l.invoke(this),!0}}catch(h){console.error(h)}return!1}preload(e){if(e>=0&&e<this.scenes.length){const t=this.scenes[e];if(t instanceof ce)return t.preload()}return or}tryLoadFromQueryParam(){var e;if(!((e=this.queryParameterName)!=null&&e.length))return or;const t=C(this.queryParameterName);return typeof t=="boolean"?or:this.trySelectSceneFromValue(t)}trySelectSceneFromValue(e){if(typeof e=="string"){const t=parseInt(e);if(t>=0&&t<this.scenes.length)return this.select(t);{const s=e.toLowerCase();for(let o=0;o<this.scenes.length;o++){const r=this.scenes[o];if(!!r&&(r instanceof A?r.name:_S(r.url)).toLowerCase().includes(s))return this.select(o)}}}else if(typeof e=="number"&&e>=0&&e<this.scenes.length)return this.select(e);return Xt()&&console.warn('Can not find scene: "'+e+'"',this),or}async onStartLoading(){var e,t;if(this._isCurrentlyLoading=!0,this.loadingScene&&(this._lastLoadingScene!==this.loadingScene&&(this._loadingScenePromise=void 0),this._lastLoadingScene=this.loadingScene,this._loadingScenePromise||(this._loadingScenePromise=(e=this.loadingScene)==null?void 0:e.loadAssetAsync().then(s=>s!=null)),await this._loadingScenePromise,this._isCurrentlyLoading&&(t=this.loadingScene)!=null&&t.asset)){Ht&&console.log("Add loading scene",this.loadingScene.url,this.loadingScene.asset);const s=this.loadingScene.asset;P.add(s,this.gameObject);const o=this.tryGetSceneEventListener(s);if(o!=null&&o.sceneOpened){const r=o.sceneOpened(this);r instanceof Promise&&await r}}if(this._isCurrentlyLoading){const s=this.tryGetSceneEventListener(this.gameObject);if(s&&s.sceneOpened){const o=s.sceneOpened(this);o instanceof Promise&&await o}}}async onEndLoading(){var e;if(this._isCurrentlyLoading=!1,(e=this.loadingScene)!=null&&e.asset){Ht&&console.log("Remove loading scene",this.loadingScene.url);const t=this.loadingScene.asset,s=this.tryGetSceneEventListener(t);if(typeof s?.sceneClosing=="function"){const o=s.sceneClosing();o instanceof Promise&&await o}P.remove(t)}if(!this._isCurrentlyLoading){const t=this.tryGetSceneEventListener(this.gameObject);if(t&&t.sceneClosing){const s=t.sceneClosing();s instanceof Promise&&await s}}}tryGetSceneEventListener(e,t=0){if(!e)return null;const s=P.foreachComponent(e,o=>{const r=o;if(r.sceneClosing||r.sceneOpened)return r});if(t===0&&!s&&e.children.length)for(const o of e.children){const r=this.tryGetSceneEventListener(o,t+1);if(r)return r}return s||null}}Pt([m()],Ze.prototype,"autoLoadFirstScene"),Pt([m(ce)],Ze.prototype,"scenes"),Pt([m(ce)],Ze.prototype,"loadingScene"),Pt([m()],Ze.prototype,"queryParameterName"),Pt([m()],Ze.prototype,"useSceneName"),Pt([m()],Ze.prototype,"clamp"),Pt([m()],Ze.prototype,"useHistory"),Pt([m()],Ze.prototype,"useKeyboard"),Pt([m()],Ze.prototype,"useSwipe"),Pt([m()],Ze.prototype,"useSceneLighting"),Pt([m()],Ze.prototype,"useSceneBackground"),Pt([m()],Ze.prototype,"preloadNext"),Pt([m()],Ze.prototype,"preloadPrevious"),Pt([m()],Ze.prototype,"preloadConcurrent"),Pt([m()],Ze.prototype,"createMenuButtons"),Pt([m(xe)],Ze.prototype,"sceneLoadingStart"),Pt([m(xe)],Ze.prototype,"sceneLoadingProgress"),Pt([m(xe)],Ze.prototype,"sceneLoaded");function _S(n){const e=n.split("/").pop(),t=e?.split(".").shift();return t!=null&&t.length?t:n}class dI{constructor(e,t=1,s=1,o=2){a(this,"maxLoadAhead"),a(this,"maxLoadBehind"),a(this,"maxConcurrent"),a(this,"_isRunning",!1),a(this,"_switcher"),a(this,"_loadTasks",[]),a(this,"_maxConcurrentLoads",1),this._switcher=e,this.maxLoadAhead=t,this.maxLoadBehind=s,this.maxConcurrent=o}begin(e){if(this._isRunning)return;Ht&&console.log("Preload begin",{delay:e}),this._isRunning=!0;let t=-10,s,o;const r=this._switcher.scenes,l=Date.now()+e,c=setInterval(()=>{if(this.allLoaded()&&(Ht&&console.log("All scenes (pre-)loaded"),this.stop()),!this._isRunning){clearInterval(c);return}if(Date.now()<l||this.canLoadNewScene()===!1)return;(t===-10||t!==this._switcher.currentIndex)&&(t=this._switcher.currentIndex,o=0,s=0);const h=o%2===0;h&&(s+=1),o+=1;const d=h?this.maxLoadAhead:this.maxLoadBehind;if(s>d)return;const u=h?t+s:t-s;if(!(u<0)&&!(u<0||u>=r.length)&&!this._loadTasks.some(p=>p.index===u)){const p=r[u];Ht&&console.log("Preload scene",{roomIndex:u,searchForward:h,lastRoom:t,currentIndex:this._switcher.currentIndex,tasks:this._loadTasks.length},p?.url),new uI(u,p,this._loadTasks)}},200)}stop(){this._isRunning=!1}canLoadNewScene(){return this._loadTasks.length<this._maxConcurrentLoads}allLoaded(){if(this._switcher.scenes){for(const e of this._switcher.scenes)if(e!=null&&e.isLoaded&&e.isLoaded()===!1)return!1}return!0}}class uI{constructor(e,t,s){a(this,"index"),a(this,"asset"),a(this,"tasks"),this.index=e,this.asset=t,this.tasks=s,s.push(this),this.awaitLoading()}async awaitLoading(){this.asset&&!this.asset.isLoaded()&&(Ht&&console.log("Preload start: "+this.asset.url,this.index),await this.asset.preload(),Ht&&console.log("Preload finished: "+this.asset.url,this.index));const e=this.tasks.indexOf(this);e>=0&&this.tasks.splice(e,1)}}function pI(){return new Promise((n,e)=>{const t=()=>{t!=null&&(document.removeEventListener("pointerdown",t),document.removeEventListener("click",t),document.removeEventListener("dragstart",t),document.removeEventListener("touchstart",t),n())};document.addEventListener("pointerdown",t),document.addEventListener("click",t),document.addEventListener("dragstart",t),document.addEventListener("touchstart",t)})}async function mI(n){await pI(),n()}var gI=Object.defineProperty,fI=Object.getOwnPropertyDescriptor,$i=(n,e,t,s)=>{for(var o=s>1?void 0:s?fI(e,t):e,r=n.length-1,l;r>=0;r--)(l=n[r])&&(o=(s?l(e,t,o):l(o))||o);return s&&o&&gI(e,t,o),o};const Ot=C("debugvideo");var wS=(n=>(n[n.None=0]="None",n[n.AdjustHeight=1]="AdjustHeight",n[n.AdjustWidth=2]="AdjustWidth",n))(wS||{}),xS=(n=>(n[n.VideoClip=0]="VideoClip",n[n.Url=1]="Url",n))(xS||{}),SS=(n=>(n[n.CameraFarPlane=0]="CameraFarPlane",n[n.CameraNearPlane=1]="CameraNearPlane",n[n.RenderTexture=2]="RenderTexture",n[n.MaterialOverride=3]="MaterialOverride",n))(SS||{});class yt extends j{constructor(){super(),a(this,"playOnAwake",!0),a(this,"aspectMode",0),a(this,"clip",null),a(this,"source",1),a(this,"_url",null),a(this,"renderMode"),a(this,"targetMaterialProperty"),a(this,"targetMaterialRenderer"),a(this,"targetTexture"),a(this,"time",0),a(this,"_playbackSpeed",1),a(this,"_isLooping",!1),a(this,"_muted",!1),a(this,"_audioOutputMode",2),a(this,"playInBackground",!0),a(this,"_crossOrigin","anonymous"),a(this,"_videoElement",null),a(this,"_videoTexture",null),a(this,"_videoMaterial",null),a(this,"_isPlaying",!1),a(this,"wasPlaying",!1),a(this,"visibilityChanged",e=>{switch(document.visibilityState){case"hidden":this.playInBackground||(this.wasPlaying=this._isPlaying,this.pause());break;case"visible":this.wasPlaying&&!this._isPlaying&&this.play();break}}),a(this,"_receivedInput",!1),a(this,"_overlay",null),a(this,"_targetObjects"),a(this,"_updateAspectRoutineId",-1),a(this,"_hls"),a(this,"onHlsAvailable",()=>{var e;Ot&&console.log("HLS: available",this.clip),!(!this.shouldUseM3U||!this.url)&&(this._hls||(this._hls=new Hls),this.videoElement.autoplay=!0,this._hls.loadSource(this.url),this._hls.attachMedia(this.videoElement),(e=this._videoElement)==null||e.play(),Ot&&console.log("HLS: loaded",this.clip))}),mI(()=>{this._receivedInput=!0,this.updateVideoElementSettings()}),this._targetObjects=[],C("videoscreenspace")&&window.addEventListener("keydown",e=>{e.key==="f"&&(this.screenspace=!this.screenspace)})}get url(){return this._url}set url(e){const t=this._url!==e;this.__didAwake?t&&this.setClipURL(e??""):this._url=e}get playbackSpeed(){var e;return((e=this._videoElement)==null?void 0:e.playbackRate)??this._playbackSpeed}set playbackSpeed(e){this._playbackSpeed=e,this._videoElement&&(this._videoElement.playbackRate=e)}get isLooping(){var e;return((e=this._videoElement)==null?void 0:e.loop)??this._isLooping}set isLooping(e){this._isLooping=e,this._videoElement&&(this._videoElement.loop=e)}get currentTime(){var e;return((e=this._videoElement)==null?void 0:e.currentTime)??this.time}set currentTime(e){this._videoElement?this._videoElement.currentTime=e:this.time=e}get isPlaying(){const e=this._videoElement;return!!(e&&(e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>e.HAVE_CURRENT_DATA||e.srcObject&&e.srcObject.active))}get crossOrigin(){var e;return((e=this._videoElement)==null?void 0:e.crossOrigin)??this._crossOrigin}set crossOrigin(e){this._crossOrigin=e,this._videoElement&&(e!==null?this._videoElement.setAttribute("crossorigin",e):this._videoElement.removeAttribute("crossorigin"))}get videoMaterial(){return!this._videoMaterial&&!this.create(!1)?null:this._videoMaterial}get videoTexture(){return!this._videoTexture&&!this.create(!1)?null:this._videoTexture}get videoElement(){return!this._videoElement&&!this.create(!1)?null:this._videoElement}requestPictureInPicture(){return this._videoElement?this._videoElement.requestPictureInPicture():null}get muted(){var e;return((e=this._videoElement)==null?void 0:e.muted)??this._muted}set muted(e){this._muted=e,this._videoElement&&(this._videoElement.muted=e)}get currentVideo(){return this.clip}set audioOutputMode(e){e!==this._audioOutputMode&&(e===1&&B()&&console.warn("VideoAudioOutputMode.AudioSource is not yet implemented"),this._audioOutputMode=e,this.updateVideoElementSettings())}get audioOutputMode(){return this._audioOutputMode}preloadVideo(){Ot&&console.log("Video Preload: "+this.name,this.clip),this.create(!1)}preload(){this.preloadVideo()}setVideo(e){this.clip=e,this.source=0,this._videoElement?(this._videoElement.srcObject=e,this._isPlaying&&this.play(),this.updateAspect()):this.create(this.playOnAwake)}setClipURL(e){this._url!==e&&(this._url=e,this.source=1,Ot&&console.log("set url",e),this._videoElement?e.endsWith(".m3u8")||e.includes(".m3u")?this.ensureM3UCanBePlayed():(this._videoElement.src=e,this._isPlaying&&(this.stop(),this.play())):this.create(this.playOnAwake))}onEnable(){var e,t;Ot&&console.log("VideoPlayer.onEnable",xS[this.source],this.clip,this.url,this),window.addEventListener("visibilitychange",this.visibilityChanged),this.playOnAwake===!0?this.create(!0):this.preloadVideo(),this.screenspace?(e=this._overlay)==null||e.start():(t=this._overlay)==null||t.stop()}onDisable(){var e;window.removeEventListener("visibilitychange",this.visibilityChanged),(e=this._overlay)==null||e.stop(),this.pause()}onDestroy(){var e;this._videoElement&&((e=this.videoElement)==null||e.remove(),this._videoElement=null),this._videoTexture&&(this._videoTexture.dispose(),this._videoTexture=null)}play(){var e,t;if(this._videoElement||this.create(!1),!this._videoElement){Ot&&console.warn("Can not play: no video element found",this);return}if(!(this._isPlaying&&!((e=this._videoElement)!=null&&e.ended)&&!((t=this._videoElement)!=null&&t.paused))){if(this._isPlaying=!0,this._receivedInput||(this._videoElement.muted=!0),this.handleBeginPlaying(!1),this.shouldUseM3U){this.ensureM3UCanBePlayed();return}Ot&&console.log("Video Play()",this.clip,this._videoElement,this.time),this._videoElement.currentTime=this.time,this._videoElement.play().catch(s=>{var o;console.log(s),Ot&&console.error("Error playing video",s,"CODE="+s.code,(o=this.videoElement)==null?void 0:o.src,this),setTimeout(()=>{this._isPlaying&&!this.destroyed&&this.activeAndEnabled&&this.play()},1e3)}),Ot&&console.log("play",this._videoElement,this.time)}}stop(){this._isPlaying=!1,this.time=0,this._videoElement&&(this._videoElement.currentTime=0,this._videoElement.pause(),Ot&&console.log("STOP",this))}pause(){var e,t;this.time=((e=this._videoElement)==null?void 0:e.currentTime)??0,this._isPlaying=!1,(t=this._videoElement)==null||t.pause(),Ot&&console.log("PAUSE",this,this.currentTime)}create(e){let t;switch(this.source){case 0:t=this.clip;break;case 1:t=this.url,!(t!=null&&t.length)&&typeof this.clip=="string"&&(t=this.clip);break}return t?(this._videoElement||(Ot&&console.warn("Create VideoElement",this),this._videoElement=this.createVideoElement(),this.context.domElement.shadowRoot.prepend(this._videoElement),this.updateVideoElementStyles()),typeof t=="string"?(Ot&&console.log("Set Video src",t),this._videoElement.src=t):(Ot&&console.log("Set Video srcObject",t),this._videoElement.srcObject=t),this._videoTexture||(this._videoTexture=new DP(this._videoElement)),this._videoTexture.flipY=!1,this._videoTexture.colorSpace=Mn,e&&this.handleBeginPlaying(e),Ot&&console.log("Video: handle playing done...",t,e),!0):(Ot&&console.warn("No video source set",this),!1)}updateAspect(){this.aspectMode!==0&&this.startCoroutine(this.updateAspectImpl())}get screenspace(){var e;return((e=this._overlay)==null?void 0:e.enabled)??!1}set screenspace(e){var t;if(e){if(!this._videoTexture)return;this._overlay||(this._overlay=new yI(this.context)),this._overlay.add(this._videoTexture)}else(t=this._overlay)==null||t.remove(this._videoTexture);this._overlay&&(this._overlay.enabled=e)}createVideoElement(){const e=document.createElement("video");return this._crossOrigin&&e.setAttribute("crossorigin",this._crossOrigin),Ot&&console.log("created video element",e),e}handleBeginPlaying(e){var t,s;if(!this.activeAndEnabled||!this._videoElement)return;this._targetObjects.length=0;let o=this.gameObject;switch(this.renderMode){case 3:o=(t=this.targetMaterialRenderer)==null?void 0:t.gameObject,o||(o=(s=P.getComponent(this.gameObject,Ui))==null?void 0:s.gameObject);break;case 2:console.error("VideoPlayer renderTexture not implemented yet. Please use material override instead");return}if(!o){console.error("Missing target for video material renderer",this.name,SS[this.renderMode],this);return}const r=o.material;if(r){this._targetObjects.push(o),r!==this._videoMaterial&&(this._videoMaterial=r.clone(),o.material=this._videoMaterial);const l="map",c=this._videoMaterial;if(!this.targetMaterialProperty)c[l]=this._videoTexture;else switch(this.targetMaterialProperty){default:c[l]=this._videoTexture;break}}else{console.warn("Can not play video, no material found, this might be a multimaterial case which is not supported yet");return}this.updateVideoElementSettings(),this.updateVideoElementStyles(),e&&(this.shouldUseM3U&&this.ensureM3UCanBePlayed(),this.play())}updateVideoElementSettings(){if(!this._videoElement)return;this._videoElement.loop=this._isLooping,this._videoElement.currentTime=this.currentTime,this._videoElement.playbackRate=this._playbackSpeed,this._videoElement.playsInline=!0;let e=!this._receivedInput||this.audioOutputMode===0;!e&&this._muted&&(e=!0),this._videoElement.muted=e,this.playOnAwake&&(this._videoElement.autoplay=!0)}updateVideoElementStyles(){this._videoElement&&(this._videoElement.style.userSelect="none",this._videoElement.style.visibility="hidden",this._videoElement.style.display="none",this.updateAspect())}*updateAspectImpl(){const e=++this._updateAspectRoutineId,t=void 0,s=this.clip;for(;e===this._updateAspectRoutineId&&this.aspectMode!==0&&this.clip&&s===this.clip&&this._isPlaying;){if(!s||typeof s=="string")return;let o;for(const r of s.getVideoTracks()){const l=r.getSettings();if(l&&l.width&&l.height){o=l.width/l.height;break}else o=this.context.renderer.domElement.clientWidth/this.context.renderer.domElement.clientHeight}if(o===void 0){for(let r=0;r<10;r++)yield;if(!this.isPlaying)break;continue}if(t===o){yield;continue}for(const r of this._targetObjects){let l=1;if(r.parent){const c=Ge(r.parent);l=c.x/c.y}switch(this.aspectMode){case 1:r.scale.y=1/o*r.scale.x*l;break;case 2:r.scale.x=o*r.scale.y*l;break}}for(let r=0;r<3;r++)yield}}get shouldUseM3U(){return this.url!=null&&(this.url.endsWith(".m3u8")||this.url.endsWith(".m3u"))&&this.source===1}ensureM3UCanBePlayed(){if(!this.shouldUseM3U)return;let e=document.head.querySelector("script[data-hls_library]");e?globalThis.Hls?this.onHlsAvailable():e.addEventListener("load",this.onHlsAvailable):(Ot&&console.log("HLS: load script"),e=document.createElement("script"),e.dataset.hls_library="hls.js",e.src="https://cdn.jsdelivr.net/npm/hls.js@1",e.addEventListener("load",this.onHlsAvailable),document.head.append(e))}}$i([m()],yt.prototype,"playOnAwake",2),$i([m()],yt.prototype,"aspectMode",2),$i([m(URL)],yt.prototype,"clip",2),$i([m()],yt.prototype,"source",2),$i([m(URL)],yt.prototype,"url",1),$i([m()],yt.prototype,"renderMode",2),$i([m()],yt.prototype,"targetMaterialProperty",2),$i([m(Ui)],yt.prototype,"targetMaterialRenderer",2),$i([m(je)],yt.prototype,"targetTexture",2),$i([m()],yt.prototype,"time",2),$i([m()],yt.prototype,"playbackSpeed",1),$i([m()],yt.prototype,"isLooping",1),$i([m()],yt.prototype,"audioOutputMode",1);class yI{constructor(e){a(this,"context"),a(this,"_videos",[]),a(this,"_screenspaceModeQuad"),a(this,"_isInScreenspaceMode",!1),a(this,"_input"),this.context=e,this._input=new vI(this)}get enabled(){return this._isInScreenspaceMode}set enabled(e){e?this.start():this.stop()}add(e){this._videos.indexOf(e)===-1&&this._videos.push(e)}remove(e){if(!e)return;const t=this._videos.indexOf(e);t>=0&&this._videos.splice(t,1)}start(){var e;if(this._isInScreenspaceMode||this._videos.length<0)return;const t=this._videos[this._videos.length-1];if(!t)return;if(this._isInScreenspaceMode=!0,!this._screenspaceModeQuad){if(this._screenspaceModeQuad=xo.createPrimitive(Sr.Quad,{material:new bI(t)}),!this._screenspaceModeQuad)return;this._screenspaceModeQuad.geometry.scale(2,2,2)}const s=this._screenspaceModeQuad;this.context.scene.add(s),this.updateScreenspaceMaterialUniforms();const o=s.material;o?.reset(),(e=this._input)==null||e.enable(o)}stop(){var e;this._isInScreenspaceMode=!1,this._screenspaceModeQuad&&((e=this._input)==null||e.disable(),this._screenspaceModeQuad.removeFromParent())}updateScreenspaceMaterialUniforms(){var e;const t=(e=this._screenspaceModeQuad)==null?void 0:e.material;t&&(t.screenAspect=this.context.domElement.clientWidth/this.context.domElement.clientHeight)}}class vI{constructor(e){a(this,"_onResizeScreenFn"),a(this,"_onKeyUpFn"),a(this,"_onMouseWheelFn"),a(this,"context"),a(this,"overlay"),a(this,"_material"),a(this,"_isPinching",!1),a(this,"_lastPinch",0),this.overlay=e,this.context=e.context}enable(e){this._material=e,window.addEventListener("resize",this._onResizeScreenFn=()=>{this.overlay.updateScreenspaceMaterialUniforms()}),window.addEventListener("keyup",this._onKeyUpFn=o=>{o.key==="Escape"&&this.overlay.stop()}),window.addEventListener("wheel",this._onMouseWheelFn=o=>{this.overlay.enabled&&(e.zoom+=o.deltaY*5e-4,o.preventDefault())},{passive:!1});const t=new ie;window.addEventListener("mousemove",o=>{if(this.overlay.enabled&&this.context.input.getPointerPressed(0)){const r=new ie(o.movementX,o.movementY);r.x/=this.context.domElement.clientWidth,r.y/=this.context.domElement.clientHeight,t.set(r.x,r.y),t.multiplyScalar(e.zoom/-this.context.time.deltaTime*.01),e.offset=e.offset.add(t)}}),window.addEventListener("pointermove",o=>{this.overlay.enabled&&this.context.input.getPointerPressed(0)&&this.context.input.getTouchesPressedCount()===1&&(t.set(o.movementX,o.movementY),t.multiplyScalar(e.zoom*-this.context.time.deltaTime*.05),e.offset=e.offset.add(t))});let s=0;window.addEventListener("touchstart",o=>{if(o.touches.length<2){this.context.time.time-s<.3&&this.overlay.stop(),s=this.context.time.time;return}this._isPinching=!0,this._lastPinch=0}),window.addEventListener("touchmove",o=>{if(!this._isPinching||!this._material)return;const r=o.touches[0],l=o.touches[1],c=r.clientX-l.clientX,h=r.clientY-l.clientY,d=Math.sqrt(c*c+h*h);if(this._lastPinch!==0){const u=d-this._lastPinch;this._material.zoom-=u*.004}this._lastPinch=d}),window.addEventListener("touchend",()=>{this._isPinching=!1})}disable(){this._onResizeScreenFn&&(window.removeEventListener("resize",this._onResizeScreenFn),this._onResizeScreenFn=void 0),this._onKeyUpFn&&(window.removeEventListener("keyup",this._onKeyUpFn),this._onKeyUpFn=void 0),this._onMouseWheelFn&&(window.removeEventListener("wheel",this._onMouseWheelFn),this._onMouseWheelFn=void 0)}}class bI extends Ns{constructor(e){super(),a(this,"_offset",new ie),this.uniforms={map:{value:e},screenAspect:{value:1},offsetScale:{value:new fe(0,0,1,1)}},this.vertexShader=`
|
|
1326
1326
|
uniform sampler2D map;
|