babylonjs-editor-tools 5.5.1-alpha.1 → 5.5.1-alpha.2

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.
@@ -1,4 +1,4 @@
1
- var je=Object.defineProperty;var yn=Object.getOwnPropertyDescriptor;var bn=Object.getOwnPropertyNames;var xn=Object.prototype.hasOwnProperty;var a=(t,e)=>je(t,"name",{value:e,configurable:!0});var Cn=(t,e)=>{for(var i in e)je(t,i,{get:e[i],enumerable:!0})},Ln=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of bn(e))!xn.call(t,r)&&r!==i&&je(t,r,{get:()=>e[r],enumerable:!(o=yn(e,r))||o.enumerable});return t};var Dn=t=>Ln(je({},"__esModule",{value:!0}),t);var ls={};Cn(ls,{AdvancedAssetContainer:()=>ze,AdvancedAssetContainerInstantiatedEntries:()=>Be,Cinematic:()=>We,Database:()=>$e,NodeParticleSystemSet:()=>an.NodeParticleSystemSet,VolumetricDebugMode:()=>xo,VolumetricDepthSource:()=>ui,VolumetricDitherMode:()=>ni,VolumetricFogMode:()=>ai,VolumetricLightingRenderingPipeline:()=>q,VolumetricShadowKind:()=>mi,VolumetricShadowMode:()=>Oo,VolumetricStepDistribution:()=>bo,VolumetricTransmittanceMode:()=>hi,_applyScriptsForObject:()=>B,_getKtx2TextureName:()=>ft,_preloadScriptsAssets:()=>Vi,_registerScriptInstance:()=>Gi,_removeRegisteredScriptInstance:()=>mt,addExcludedCompressedTexture:()=>ut,animationFromSprite:()=>Qa,animationGroupFromScene:()=>Ma,applyMeshesLODQuality:()=>It,applyRagdollJointLimits:()=>va,applyRenderingConfigurationForCamera:()=>_i,applyScriptOnObject:()=>Ca,applyShadowsQuality:()=>An,applyTexturesQuality:()=>_a,canUseHdr:()=>ga,componentFromScene:()=>Aa,computeVolumetricBudget:()=>Me,computeVolumetricShapeKey:()=>jn,configureEngineToUseCompressedTextures:()=>Da,configureMeshDistanceOrScreenCoverage:()=>At,configureShadowMapRefreshRate:()=>qe,configureShadowMapRenderListPredicate:()=>Mt,copyAndParseRagdollConfiguration:()=>Oi,createAndOpenDatabase:()=>Yi,createDefaultRenderingPipeline:()=>yo,createMotionBlurPostProcess:()=>fo,createSSAO2RenderingPipeline:()=>mo,createSSRRenderingPipeline:()=>so,createTAARenderingPipeline:()=>co,createVLSPostProcess:()=>no,createVolumetricLightingPrePassConfiguration:()=>gi,createVolumetricLightingRenderingPipeline:()=>Xo,defaultPipelineCameraConfigurations:()=>ve,disposeDefaultRenderingPipeline:()=>Qt,disposeMotionBlurPostProcess:()=>jt,disposeSSAO2RenderingPipeline:()=>Wt,disposeSSRRenderingPipeline:()=>Gt,disposeTAARenderingPipeline:()=>Ht,disposeVLSPostProcess:()=>Vt,disposeVolumetricLightingRenderingPipeline:()=>Ci,ensureVolumetricLightConfiguration:()=>Lo,forceCompileAllSceneMaterials:()=>Ea,generateCinematicAnimationGroup:()=>os,getAllScriptsByClassForObject:()=>Pe,getAllVolumetricCandidateLights:()=>Eo,getAnimationTypeForObject:()=>Ue,getDefaultRenderingPipeline:()=>Ie,getDefaultVolumetricLightConfiguration:()=>oi,getDefaultVolumetricLightingConfiguration:()=>Qe,getFromIndexDB:()=>Xe,getHdrTextureType:()=>$,getMotionBlurPostProcess:()=>Kt,getPowerOfTwoUntil:()=>N,getSSAO2RenderingPipeline:()=>Nn,getSSRRenderingPipeline:()=>Mn,getScriptByClassForObject:()=>Ni,getTAARenderingPipeline:()=>Vn,getTextureUrl:()=>gt,getVLSPostProcess:()=>Rt,getVolumetricGeometryBufferDepthTexture:()=>Si,getVolumetricGeometryBufferRenderer:()=>Ve,getVolumetricLightConfiguration:()=>li,getVolumetricLightRange:()=>tt,getVolumetricLightSteps:()=>si,getVolumetricLightWorldDirection:()=>Re,getVolumetricLightWorldPosition:()=>et,getVolumetricLightingRenderingPipeline:()=>ma,getVolumetricPrePassDepthTexture:()=>vi,getVolumetricPrePassRenderer:()=>ye,guiFromAsset:()=>Va,isAbstractMesh:()=>re,isAnyParticleSystem:()=>wt,isArcRotateCamera:()=>On,isBone:()=>_n,isCamera:()=>Ze,isCascadedShadowGenerator:()=>Dt,isCinematicGroup:()=>ts,isCinematicKey:()=>ji,isCinematicKeyCut:()=>Oe,isCinematicKeyEvent:()=>es,isCinematicSound:()=>is,isClusteredLightContainer:()=>pe,isDecalMesh:()=>Ji,isDirectionalLight:()=>ie,isFreeCamera:()=>wn,isGPUParticleSystem:()=>En,isGaussianSplattingMesh:()=>Et,isGroundMesh:()=>Pn,isHemisphericLight:()=>Ye,isInstancedMesh:()=>Te,isLight:()=>Qi,isMesh:()=>F,isNode:()=>me,isNodeFromStaticGroup:()=>Tt,isParticleSystem:()=>Pt,isPointLight:()=>Ct,isScene:()=>_t,isShadowGenerator:()=>Lt,isSoundNode:()=>ae,isSpotLight:()=>ne,isSprite:()=>Ot,isTexture:()=>Ae,isTransformNode:()=>te,isUsingKtx2CompressedTextures:()=>ke,isVolumetricLightEnabled:()=>Hn,isVolumetricLightSupported:()=>Zn,isVolumetricLightingSupported:()=>da,loadMaterialFromFile:()=>Oa,loadScene:()=>wa,markVolumetricLightsDirty:()=>fa,maxVolumetricArrayLights:()=>K,maxVolumetricDirectionalLights:()=>ri,maxVolumetricShadowSlots:()=>E,motionBlurPostProcessCameraConfigurations:()=>ge,nodeFromDescendants:()=>Ia,nodeFromScene:()=>Ta,normalizeAtlasJson:()=>zi,normalizeVolumetricLightConfiguration:()=>Co,normalizeVolumetricLightingConfiguration:()=>Se,onKeyboardEvent:()=>Ya,onPointerEvent:()=>Za,openIndexDB:()=>Zi,parseCinematic:()=>Ja,parseCinematicKeyValue:()=>k,parseDefaultRenderingPipeline:()=>ei,parseKeyFrameAnimations:()=>$i,parseMotionBlurPostProcess:()=>Yt,parseRagdollConfiguration:()=>Qo,parseSSAO2RenderingPipeline:()=>$t,parseSSRRenderingPipeline:()=>zt,parseTAARenderingPipeline:()=>Ut,parseVLSPostProcess:()=>Nt,parseVolumetricLightingRenderingPipeline:()=>Di,particleSystemFromScene:()=>Na,playSpriteAnimationFromName:()=>Pa,preloadAssetsToDatabase:()=>ss,putInIndexDB:()=>W,registerScriptAssetParser:()=>xa,resolveVolumetricDepthSource:()=>it,resolveVolumetricShadowSlot:()=>To,saveRenderingConfigurationForCamera:()=>ua,sceneAsset:()=>Ra,scriptAssetsCache:()=>I,scriptAssetsParsers:()=>He,scriptsDictionary:()=>H,selectVolumetricLights:()=>di,serializeDefaultRenderingPipeline:()=>Jt,serializeMotionBlurPostProcess:()=>Zt,serializeSSAO2RenderingPipeline:()=>Xt,serializeSSRRenderingPipeline:()=>Bt,serializeTAARenderingPipeline:()=>kt,serializeVLSPostProcess:()=>Ft,serializeVolumetricLightingRenderingPipeline:()=>Li,setDefaultRenderingPipelineRef:()=>zn,setMotionBlurPostProcessRef:()=>Bn,setSSAO2RenderingPipelineRef:()=>Gn,setSSRRenderingPipelineRef:()=>Rn,setStaticDecalsEnabled:()=>Tn,setTAARenderingPipelineRef:()=>Fn,setUseKtx2CompressedTextures:()=>La,setVLSPostProcessRef:()=>In,setVolumetricLightingRenderingPipelineRef:()=>ha,setupOfflineProvider:()=>rs,soundFromScene:()=>Fa,spriteFromSpriteManager:()=>qa,ssaoRenderingPipelineCameraConfigurations:()=>ue,ssrRenderingPipelineCameraConfigurations:()=>de,supportsVolumetricFloatDepthTexture:()=>Io,taaRenderingPipelineCameraConfigurations:()=>fe,visibleAsAsset:()=>ja,visibleAsBoolean:()=>Ga,visibleAsColor3:()=>Ua,visibleAsColor4:()=>Wa,visibleAsEntity:()=>Xa,visibleAsKeyMap:()=>Ka,visibleAsNumber:()=>za,visibleAsString:()=>Ba,visibleAsTexture:()=>$a,visibleAsVector2:()=>Ha,visibleAsVector3:()=>ka,vlsPostProcessCameraConfigurations:()=>he,volumetricLightMetadataKey:()=>se,volumetricLightingPrePassConfigurationName:()=>Ao,volumetricLightingRenderingPipelineCameraConfigurations:()=>xe});module.exports=Dn(ls);function re(t){switch(t.getClassName?.()){case"Mesh":case"LineMesh":case"GroundMesh":case"InstancedMesh":return!0}return!1}a(re,"isAbstractMesh");function F(t){switch(t.getClassName?.()){case"Mesh":case"GroundMesh":return!0}return!1}a(F,"isMesh");function Te(t){return t.getClassName?.()==="InstancedMesh"}a(Te,"isInstancedMesh");function _n(t){return t.getClassName?.()==="Bone"}a(_n,"isBone");function Pn(t){return t.getClassName?.()==="GroundMesh"}a(Pn,"isGroundMesh");function te(t){return t.getClassName?.()==="TransformNode"}a(te,"isTransformNode");function Ae(t){return t?.getClassName?.()==="Texture"}a(Ae,"isTexture");function Ze(t){switch(t.getClassName?.()){case"Camera":case"FreeCamera":case"TargetCamera":case"EditorCamera":case"ArcRotateCamera":case"UniversalCamera":return!0}return!1}a(Ze,"isCamera");function wn(t){switch(t.getClassName?.()){case"FreeCamera":case"UniversalCamera":return!0}return!1}a(wn,"isFreeCamera");function On(t){return t.getClassName?.()==="ArcRotateCamera"}a(On,"isArcRotateCamera");function Ct(t){return t.getClassName?.()==="PointLight"}a(Ct,"isPointLight");function ie(t){return t.getClassName?.()==="DirectionalLight"}a(ie,"isDirectionalLight");function ne(t){return t.getClassName?.()==="SpotLight"}a(ne,"isSpotLight");function Ye(t){return t.getClassName?.()==="HemisphericLight"}a(Ye,"isHemisphericLight");function Qi(t){switch(t.getClassName?.()){case"Light":case"PointLight":case"SpotLight":case"DirectionalLight":case"HemisphericLight":return!0}return!1}a(Qi,"isLight");function Lt(t){return t.getClassName?.()==="ShadowGenerator"}a(Lt,"isShadowGenerator");function Dt(t){return t.getClassName?.()==="CascadedShadowGenerator"}a(Dt,"isCascadedShadowGenerator");function pe(t){return t.getClassName?.()==="ClusteredLightContainer"}a(pe,"isClusteredLightContainer");function me(t){return re(t)||te(t)||Qi(t)||Ze(t)}a(me,"isNode");function _t(t){return t.getClassName?.()==="Scene"}a(_t,"isScene");function Pt(t){return t.getClassName?.()==="ParticleSystem"}a(Pt,"isParticleSystem");function En(t){return t.getClassName?.()==="GPUParticleSystem"}a(En,"isGPUParticleSystem");function wt(t){switch(t.getClassName?.()){case"ParticleSystem":case"GPUParticleSystem":return!0}return!1}a(wt,"isAnyParticleSystem");function Ot(t){return t.getClassName?.()==="Sprite"}a(Ot,"isSprite");function ae(t){return t.getClassName?.()==="SoundNode"}a(ae,"isSoundNode");function Et(t){return t.getClassName?.()==="GaussianSplattingMesh"}a(Et,"isGaussianSplattingMesh");function Tt(t){let e=t;for(;e;){if(e.metadata?.isStaticGroup)return!0;e=e.parent}return!1}a(Tt,"isNodeFromStaticGroup");function At(t){t.meshes.forEach(e=>{F(e)&&e.getLODLevels().forEach(i=>{i.mesh&&(i.mesh.originalDistanceOrScreenCoverage=i.distanceOrScreenCoverage)})})}a(At,"configureMeshDistanceOrScreenCoverage");function It(t,e){e.meshes.forEach(i=>{F(i)&&i.getLODLevels().forEach(o=>{if(o.mesh?.originalDistanceOrScreenCoverage)switch(t){case"very-low":o.distanceOrScreenCoverage=o.mesh.originalDistanceOrScreenCoverage*.125;break;case"low":o.distanceOrScreenCoverage=o.mesh.originalDistanceOrScreenCoverage*.25;break;case"medium":o.distanceOrScreenCoverage=o.mesh.originalDistanceOrScreenCoverage*.5;break;case"high":o.distanceOrScreenCoverage=o.mesh.originalDistanceOrScreenCoverage;break}})})}a(It,"applyMeshesLODQuality");function Ji(t){return(t.metadata?.decal??null)!==null}a(Ji,"isDecalMesh");function Tn(t,e){e.meshes.forEach(i=>{Ji(i)&&Tt(i)&&i.setEnabled(t)})}a(Tn,"setStaticDecalsEnabled");function N(t){let e=1;for(;e<=t;)e<<=1;return e>>1}a(N,"getPowerOfTwoUntil");var eo=require("babylonjs"),to=require("babylonjs");function Mt(t){t.lights.forEach(e=>{let i=e.getShadowGenerator()?.getShadowMap();i&&(i.renderListPredicate=o=>Et(o)?!1:eo.Vector3.Distance(o.getAbsolutePosition(),e.getAbsolutePosition())<=e.range)})}a(Mt,"configureShadowMapRenderListPredicate");async function qe(t){t.executeWhenReady(()=>{t.lights.forEach(e=>{let i=e.getShadowGenerator()?.getShadowMap();i&&(i.refreshRate=e.metadata?.refreshRate??to.RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME)})})}a(qe,"configureShadowMapRefreshRate");function An(t,e){e.lights.forEach(i=>{let o=i.getShadowGenerator(),r=o?.getShadowMap();if(o?.originalMapSize){let n=o.originalMapSize;switch(t){case"medium":n=n*.5;break;case"low":n=n*.25;break;case"very-low":n=n*.125;break}n=Math.max(128,N(n)),r?.getSize().width!==n&&r.resize(n)}}),qe(e)}a(An,"applyShadowsQuality");var io=require("babylonjs"),oo=require("babylonjs"),ro=require("babylonjs"),w=null,he=new Map;function Rt(){return w}a(Rt,"getVLSPostProcess");function In(t){w=t}a(In,"setVLSPostProcessRef");function Vt(t){w&&t.activeCamera&&(w.dispose(t.activeCamera),w=null)}a(Vt,"disposeVLSPostProcess");function no(t,e,i){return e??=t.meshes.find(o=>F(o)),w=new ro.VolumetricLightScatteringPostProcess("VolumetricLightScatteringPostProcess",1,t.activeCamera,e,100,oo.Texture.BILINEAR_SAMPLINGMODE,t.getEngine(),!1),w.samples=i?.msaaSamples??1,w}a(no,"createVLSPostProcess");function Ft(){return w?{meshId:w.mesh?.id,exposure:w.exposure,decay:w.decay,weight:w.weight,density:w.density,invert:w.invert,useCustomMeshPosition:w.useCustomMeshPosition,customMeshPosition:w.customMeshPosition.asArray()}:null}a(Ft,"serializeVLSPostProcess");function Nt(t,e,i){let o=null;if(e.meshId){let n=t.getMeshById(e.meshId);n&&F(n)&&(o=n)}let r=w??no(t,o,i);return r.samples=i?.msaaSamples??1,r.exposure=e.exposure,r.decay=e.decay,r.weight=e.weight,r.density=e.density,r.invert=e.invert,r.useCustomMeshPosition=e.useCustomMeshPosition,r.customMeshPosition.copyFrom(io.Vector3.FromArray(e.customMeshPosition)),r}a(Nt,"parseVLSPostProcess");var ao=require("babylonjs"),D=null,de=new Map;function Mn(){return D}a(Mn,"getSSRRenderingPipeline");function Rn(t){D=t}a(Rn,"setSSRRenderingPipelineRef");function Gt(){D&&(D.dispose(),D=null)}a(Gt,"disposeSSRRenderingPipeline");function so(t,e,i){return D=new ao.SSRRenderingPipeline("SSRRenderingPipeline",t,[e],void 0,$(t.getEngine())),D.samples=i?.msaaSamples??1,D}a(so,"createSSRRenderingPipeline");function Bt(){return D?{samples:D.samples,step:D.step,thickness:D.thickness,strength:D.strength,reflectionSpecularFalloffExponent:D.reflectionSpecularFalloffExponent,maxSteps:D.maxSteps,maxDistance:D.maxDistance,roughnessFactor:D.roughnessFactor,reflectivityThreshold:D.reflectivityThreshold,blurDispersionStrehgth:D.blurDispersionStrength,clipToFrustum:D.clipToFrustum,enableSmoothReflections:D.enableSmoothReflections,enableAutomaticThicknessComputation:D.enableAutomaticThicknessComputation,attenuateFacingCamera:D.attenuateFacingCamera,attenuateScreenBorders:D.attenuateScreenBorders,attenuateIntersectionDistance:D.attenuateIntersectionDistance,attenuateBackfaceReflection:D.attenuateBackfaceReflection,blurDownsample:D.blurDownsample,selfCollisionNumSkip:D.selfCollisionNumSkip,ssrDownsample:D.ssrDownsample,backfaceDepthTextureDownsample:D.backfaceDepthTextureDownsample}:null}a(Bt,"serializeSSRRenderingPipeline");function zt(t,e,i,o){let r=D??so(t,e,o);return r.samples=o?.msaaSamples??1,r.step=i.step,r.thickness=i.thickness,r.strength=i.strength,r.reflectionSpecularFalloffExponent=i.reflectionSpecularFalloffExponent,r.maxSteps=i.maxSteps,r.maxDistance=i.maxDistance,r.roughnessFactor=i.roughnessFactor,r.reflectivityThreshold=i.reflectivityThreshold,r.blurDispersionStrength=i.blurDispersionStrehgth,r.clipToFrustum=i.clipToFrustum,r.enableSmoothReflections=i.enableSmoothReflections,r.enableAutomaticThicknessComputation=i.enableAutomaticThicknessComputation,r.attenuateFacingCamera=i.attenuateFacingCamera,r.attenuateScreenBorders=i.attenuateScreenBorders,r.attenuateIntersectionDistance=i.attenuateIntersectionDistance,r.attenuateBackfaceReflection=i.attenuateBackfaceReflection,r.blurDownsample=i.blurDownsample,r.selfCollisionNumSkip=i.selfCollisionNumSkip,r.ssrDownsample=i.ssrDownsample,r.backfaceDepthTextureDownsample=i.backfaceDepthTextureDownsample,r}a(zt,"parseSSRRenderingPipeline");var lo=require("babylonjs"),T=null,fe=new Map;function Vn(){return T}a(Vn,"getTAARenderingPipeline");function Fn(t){T=t}a(Fn,"setTAARenderingPipelineRef");function Ht(){T&&(T.dispose(),T=null)}a(Ht,"disposeTAARenderingPipeline");function co(t,e,i){return T=new lo.TAARenderingPipeline("TAARenderingPipeline",t,[e],$(t.getEngine())),T.msaaSamples=i?.msaaSamples??1,T}a(co,"createTAARenderingPipeline");function kt(){return T?{factor:T.factor,samples:T.samples,clampHistory:T.clampHistory,reprojectHistory:T.reprojectHistory,disableOnCameraMove:T.disableOnCameraMove}:null}a(kt,"serializeTAARenderingPipeline");function Ut(t,e,i,o){let r=T??co(t,e,o);return r.msaaSamples=o?.msaaSamples??1,r.factor=i.factor,r.clampHistory=i.clampHistory,r.reprojectHistory=i.reprojectHistory,r.disableOnCameraMove=i.disableOnCameraMove,r}a(Ut,"parseTAARenderingPipeline");var po=require("babylonjs"),P=null,ue=new Map;function Nn(){return P}a(Nn,"getSSAO2RenderingPipeline");function Gn(t){P=t}a(Gn,"setSSAO2RenderingPipelineRef");function Wt(){P&&(P.dispose(),P=null)}a(Wt,"disposeSSAO2RenderingPipeline");function mo(t,e,i){return P=new po.SSAO2RenderingPipeline("SSAO2RenderingPipeline",t,1,[e],void 0,$(t.getEngine())),P.textureSamples=1,P}a(mo,"createSSAO2RenderingPipeline");function Xt(){return P?{radius:P.radius,totalStrength:P.totalStrength,samples:P.samples,maxZ:P.maxZ,minZAspect:P.minZAspect,epsilon:P.epsilon,textureSamples:P.textureSamples,bypassBlur:P.bypassBlur,bilateralSamples:P.bilateralSamples,bilateralSoften:P.bilateralSoften,bilateralTolerance:P.bilateralTolerance,expensiveBlur:P.expensiveBlur}:null}a(Xt,"serializeSSAO2RenderingPipeline");function $t(t,e,i,o){let r=P??mo(t,e,o);return r.textureSamples=1,r.radius=i.radius,r.totalStrength=i.totalStrength,r.samples=i.samples,r.maxZ=i.maxZ,r.minZAspect=i.minZAspect,r.epsilon=i.epsilon,r.bypassBlur=i.bypassBlur,r.bilateralSamples=i.bilateralSamples,r.bilateralSoften=i.bilateralSoften,r.bilateralTolerance=i.bilateralTolerance,r.expensiveBlur=i.expensiveBlur,r}a($t,"parseSSAO2RenderingPipeline");var ho=require("babylonjs"),A=null,ge=new Map;function Kt(){return A}a(Kt,"getMotionBlurPostProcess");function Bn(t){A=t}a(Bn,"setMotionBlurPostProcessRef");function jt(){A&&(A.dispose(),A=null)}a(jt,"disposeMotionBlurPostProcess");function fo(t,e,i){return A=new ho.MotionBlurPostProcess("MotionBlurPostProcess",t,1,e,void 0,void 0,void 0,$(t.getEngine())),A.samples=i?.msaaSamples??1,A.motionStrength=1,A.isObjectBased=!0,A}a(fo,"createMotionBlurPostProcess");function Zt(){return A?{isObjectBased:A.isObjectBased,motionStrength:A.motionStrength,motionBlurSamples:A.motionBlurSamples}:null}a(Zt,"serializeMotionBlurPostProcess");function Yt(t,e,i,o){let r=A??fo(t,e,o);return r.samples=o?.msaaSamples??1,r.isObjectBased=i.isObjectBased,r.motionStrength=i.motionStrength,r.motionBlurSamples=i.motionBlurSamples,r}a(Yt,"parseMotionBlurPostProcess");var uo=require("babylonjs"),qt=require("babylonjs"),go=require("babylonjs"),vo=require("babylonjs"),So=require("babylonjs"),u=null,ve=new Map;function Ie(){return u}a(Ie,"getDefaultRenderingPipeline");function zn(t){u=t}a(zn,"setDefaultRenderingPipelineRef");function Qt(){u&&(u.dispose(),u=null)}a(Qt,"disposeDefaultRenderingPipeline");function yo(t,e,i){return u=new So.DefaultRenderingPipeline("DefaultRenderingPipeline",!0,t,[e]),u.samples=i?.msaaSamples??1,u.depthOfField.lensSize=512,u.depthOfField.fStop=.25,u.depthOfField.focusDistance=55e3,u}a(yo,"createDefaultRenderingPipeline");function Jt(){return u?{samples:u.samples,fxaaEnabled:u.fxaaEnabled,imageProcessingEnabled:u.imageProcessingEnabled,exposure:u.imageProcessing?.exposure,contrast:u.imageProcessing?.contrast,fromLinearSpace:u.imageProcessing?.fromLinearSpace,toneMappingEnabled:u.imageProcessing?.toneMappingEnabled,toneMappingType:u.imageProcessing?.toneMappingType,ditheringEnabled:u.imageProcessing?.ditheringEnabled,ditheringIntensity:u.imageProcessing?.ditheringIntensity,bloomEnabled:u.bloomEnabled,bloomThreshold:u.bloomThreshold,bloomWeight:u.bloomWeight,bloomScale:u.bloomScale,bloomKernel:u.bloomKernel,sharpenEnabled:u.sharpenEnabled,sharpenEdgeAmount:u.sharpen.edgeAmount,sharpenColorAmount:u.sharpen.colorAmount,grainEnabled:u.grainEnabled,grainIntensity:u.grain.intensity,grainAnimated:u.grain.animated,depthOfFieldEnabled:u.depthOfFieldEnabled,depthOfFieldBlurLevel:u.depthOfFieldBlurLevel,lensSize:u.depthOfField.lensSize,fStop:u.depthOfField.fStop,focusDistance:u.depthOfField.focusDistance,focalLength:u.depthOfField.focalLength,vignetteEnabled:u.imageProcessing?.vignetteEnabled,vignetteColor:u.imageProcessing?.vignetteColor.asArray(),vignetteWeight:u.imageProcessing?.vignetteWeight,chromaticAberrationEnabled:u.chromaticAberrationEnabled,aberrationAmount:u.chromaticAberration.aberrationAmount,radialIntensity:u.chromaticAberration.radialIntensity,direction:u.chromaticAberration.direction.asArray(),centerPosition:u.chromaticAberration.centerPosition.asArray(),glowLayerEnabled:u.glowLayerEnabled,glowLayerIntensity:u.glowLayer?.intensity,glowLayerBlurKernelSize:u.glowLayer?.blurKernelSize,colorGradingEnabled:u.imageProcessing.colorGradingEnabled,colorGradingTexture:u.imageProcessing.colorGradingTexture?.serialize(),colorGradingWithGreenDepth:u.imageProcessing.imageProcessingConfiguration.colorGradingWithGreenDepth,colorCurvesEnabled:u.imageProcessing.colorCurvesEnabled,globalHue:u.imageProcessing.colorCurves?.globalHue,globalDensity:u.imageProcessing.colorCurves?.globalDensity,globalExposure:u.imageProcessing.colorCurves?.globalExposure,globalSaturation:u.imageProcessing.colorCurves?.globalSaturation,highlightsHue:u.imageProcessing.colorCurves?.highlightsHue,highlightsDensity:u.imageProcessing.colorCurves?.highlightsDensity,highlightsExposure:u.imageProcessing.colorCurves?.highlightsExposure,highlightsSaturation:u.imageProcessing.colorCurves?.highlightsSaturation,midtonesHue:u.imageProcessing.colorCurves?.midtonesHue,midtonesDensity:u.imageProcessing.colorCurves?.midtonesDensity,midtonesExposure:u.imageProcessing.colorCurves?.midtonesExposure,midtonesSaturation:u.imageProcessing.colorCurves?.midtonesSaturation,shadowsHue:u.imageProcessing.colorCurves?.shadowsHue,shadowsDensity:u.imageProcessing.colorCurves?.shadowsDensity,shadowsExposure:u.imageProcessing.colorCurves?.shadowsExposure,shadowsSaturation:u.imageProcessing.colorCurves?.shadowsSaturation}:null}a(Jt,"serializeDefaultRenderingPipeline");function ei(t,e,i,o,r){let n=u??yo(t,e,r);if(n.samples=r?.msaaSamples??1,n.fxaaEnabled=i.fxaaEnabled,n.imageProcessingEnabled=i.imageProcessingEnabled,n.imageProcessing){if(n.imageProcessing.exposure=i.exposure,n.imageProcessing.contrast=i.contrast,n.imageProcessing.fromLinearSpace=i.fromLinearSpace,n.imageProcessing.toneMappingEnabled=i.toneMappingEnabled,n.imageProcessing.toneMappingType=i.toneMappingType,n.imageProcessing.ditheringEnabled=i.ditheringEnabled,n.imageProcessing.ditheringIntensity=i.ditheringIntensity,n.imageProcessing.vignetteEnabled=i.vignetteEnabled??!1,n.imageProcessing.vignetteColor=uo.Color4.FromArray(i.vignetteColor??[0,0,0]),n.imageProcessing.vignetteWeight=i.vignetteWeight??.3,n.imageProcessing.colorGradingEnabled=i.colorGradingEnabled??!1,n.imageProcessing.imageProcessingConfiguration.colorGradingWithGreenDepth=i.colorGradingWithGreenDepth??!0,i.colorGradingTexture){let l=null;if(i.colorGradingTexture.customType==="BABYLON.ColorGradingTexture"){let p=o+i.colorGradingTexture.name;l=new vo.ColorGradingTexture(p,t),l.level=i.colorGradingTexture.level}else{let p=go.Texture.Parse(i.colorGradingTexture,t,o);Ae(p)&&(l=p)}n.imageProcessing.colorGradingTexture=l}n.imageProcessing.colorCurvesEnabled=i.colorCurvesEnabled??!1,n.imageProcessing.colorCurves&&(n.imageProcessing.colorCurves.globalHue=i.globalHue??30,n.imageProcessing.colorCurves.globalDensity=i.globalDensity??0,n.imageProcessing.colorCurves.globalExposure=i.globalExposure??0,n.imageProcessing.colorCurves.globalSaturation=i.globalSaturation??0,n.imageProcessing.colorCurves.highlightsHue=i.highlightsHue??30,n.imageProcessing.colorCurves.highlightsDensity=i.highlightsDensity??0,n.imageProcessing.colorCurves.highlightsExposure=i.highlightsExposure??0,n.imageProcessing.colorCurves.highlightsSaturation=i.highlightsSaturation??0,n.imageProcessing.colorCurves.midtonesHue=i.midtonesHue??30,n.imageProcessing.colorCurves.midtonesDensity=i.midtonesDensity??0,n.imageProcessing.colorCurves.midtonesExposure=i.midtonesExposure??0,n.imageProcessing.colorCurves.midtonesSaturation=i.midtonesSaturation??0,n.imageProcessing.colorCurves.shadowsHue=i.shadowsHue??30,n.imageProcessing.colorCurves.shadowsDensity=i.shadowsDensity??0,n.imageProcessing.colorCurves.shadowsExposure=i.shadowsExposure??0,n.imageProcessing.colorCurves.shadowsSaturation=i.shadowsSaturation??0)}return n.bloomEnabled=i.bloomEnabled,n.bloomThreshold=i.bloomThreshold,n.bloomWeight=i.bloomWeight,n.bloomScale=i.bloomScale,n.bloomKernel=i.bloomKernel,n.sharpenEnabled=i.sharpenEnabled,n.sharpen.edgeAmount=i.sharpenEdgeAmount,n.sharpen.colorAmount=i.sharpenColorAmount,n.grainEnabled=i.grainEnabled,n.grain.intensity=i.grainIntensity,n.grain.animated=i.grainAnimated,n.depthOfFieldEnabled=i.depthOfFieldEnabled,n.depthOfFieldBlurLevel=i.depthOfFieldBlurLevel,n.depthOfField.lensSize=i.lensSize,n.depthOfField.fStop=i.fStop,n.depthOfField.focusDistance=i.focusDistance,n.depthOfField.focalLength=i.focalLength,n.chromaticAberrationEnabled=i.chromaticAberrationEnabled??!1,n.chromaticAberration.aberrationAmount=i.aberrationAmount??10,n.chromaticAberration.radialIntensity=i.radialIntensity??1,n.chromaticAberration.direction=qt.Vector2.FromArray(i.direction??[0,0]),n.chromaticAberration.centerPosition=qt.Vector2.FromArray(i.centerPosition??[0,0]),n.glowLayerEnabled=i.glowLayerEnabled??!1,n.glowLayer&&(n.glowLayer.intensity=i.glowLayerIntensity??1,n.glowLayer.blurKernelSize=i.glowLayerBlurKernelSize??32),n}a(ei,"parseDefaultRenderingPipeline");var se="volumetricLighting",E=8,K=256,ri=4,bo=(i=>(i[i.Linear=0]="Linear",i[i.Exponential=1]="Exponential",i))(bo||{}),ni=(o=>(o[o.None=0]="None",o[o.Bayer=1]="Bayer",o[o.InterleavedGradientNoise=2]="InterleavedGradientNoise",o))(ni||{}),ai=(o=>(o[o.Exponential=0]="Exponential",o[o.ExponentialSquared=1]="ExponentialSquared",o[o.Linear=2]="Linear",o))(ai||{}),xo=(r=>(r[r.None=0]="None",r[r.Scattering=1]="Scattering",r[r.Transmittance=2]="Transmittance",r[r.LightCount=3]="LightCount",r))(xo||{});function oi(){return{enabled:!1,volumeIntensity:1,anisotropy:.35,useCustomColor:!1,color:[1,1,1],castVolumetricShadows:!0,shadowDarkness:1,rangeMultiplier:1,priority:0}}a(oi,"getDefaultVolumetricLightConfiguration");function Qe(){return{steps:40,lightSteps:0,resolutionScale:.5,stepDistribution:1,ditherMode:2,ditherStrength:1,temporalJitter:!1,fogMode:0,fogDensity:5e-4,fogStart:0,fogEnd:2e3,fogColor:[1,1,1],albedo:1,maxDistance:1e4,heightFogEnabled:!1,heightFogBaseHeight:0,heightFogFalloff:.01,intensity:1.5,lightExtinctionEnabled:!0,lightExtinctionClamp:1e3,extinctionAmount:0,ambientColor:[1,1,1],ambientIntensity:0,screenSpaceShadows:!0,screenSpaceShadowSteps:6,screenSpaceShadowBias:.02,screenSpaceShadowMaxDistance:2e3,screenSpaceShadowThickness:4,blurPasses:2,blurRadius:3,blurDepthThreshold:.02,upsampleDepthThreshold:.02,maxLights:128,maxShadowedLights:4,pcfTaps:4,selectionRefreshRate:2,debugMode:0}}a(Qe,"getDefaultVolumetricLightingConfiguration");function si(t){return t.lightSteps>0?t.lightSteps:Math.max(4,Math.min(64,Math.round(t.steps*.3)))}a(si,"getVolumetricLightSteps");function y(t,e,i,o){let r=typeof t=="number"&&isFinite(t)?t:e;return Math.min(o,Math.max(i,r))}a(y,"normalizeNumber");function ti(t,e){return!Array.isArray(t)||t.length<3?e.slice():[y(t[0],e[0],0,100),y(t[1],e[1],0,100),y(t[2],e[2],0,100)]}a(ti,"normalizeColor");function Co(t){let e=oi();return!t||typeof t!="object"?e:{enabled:t.enabled??e.enabled,volumeIntensity:y(t.volumeIntensity,e.volumeIntensity,0,1e3),anisotropy:y(t.anisotropy,e.anisotropy,-.95,.95),useCustomColor:t.useCustomColor??e.useCustomColor,color:ti(t.color,e.color),castVolumetricShadows:t.castVolumetricShadows??e.castVolumetricShadows,shadowDarkness:y(t.shadowDarkness,e.shadowDarkness,0,1),rangeMultiplier:y(t.rangeMultiplier,e.rangeMultiplier,0,100),priority:y(t.priority,e.priority,-1e3,1e3)}}a(Co,"normalizeVolumetricLightConfiguration");function Se(t){let e=Qe();return!t||typeof t!="object"?e:{steps:Math.round(y(t.steps,e.steps,4,256)),lightSteps:Math.round(y(t.lightSteps,e.lightSteps,0,128)),resolutionScale:y(t.resolutionScale,e.resolutionScale,.1,1),stepDistribution:Math.round(y(t.stepDistribution,e.stepDistribution,0,1)),ditherMode:Math.round(y(t.ditherMode,e.ditherMode,0,2)),ditherStrength:y(t.ditherStrength,e.ditherStrength,0,1),temporalJitter:t.temporalJitter??e.temporalJitter,fogMode:Math.round(y(t.fogMode,e.fogMode,0,2)),fogDensity:y(t.fogDensity,e.fogDensity,0,100),fogStart:y(t.fogStart,e.fogStart,0,1e6),fogEnd:Math.max(y(t.fogEnd,e.fogEnd,0,1e7),y(t.fogStart,e.fogStart,0,1e6)+.001),fogColor:ti(t.fogColor,e.fogColor),albedo:y(t.albedo,e.albedo,0,1),maxDistance:y(t.maxDistance,e.maxDistance,1,1e6),heightFogEnabled:t.heightFogEnabled??e.heightFogEnabled,heightFogBaseHeight:y(t.heightFogBaseHeight,e.heightFogBaseHeight,-1e6,1e6),heightFogFalloff:y(t.heightFogFalloff,e.heightFogFalloff,0,10),intensity:y(t.intensity,e.intensity,0,100),lightExtinctionEnabled:t.lightExtinctionEnabled??e.lightExtinctionEnabled,lightExtinctionClamp:y(t.lightExtinctionClamp,e.lightExtinctionClamp,0,1e6),extinctionAmount:y(t.extinctionAmount,e.extinctionAmount,0,1),ambientColor:ti(t.ambientColor,e.ambientColor),ambientIntensity:y(t.ambientIntensity,e.ambientIntensity,0,100),screenSpaceShadows:t.screenSpaceShadows??e.screenSpaceShadows,screenSpaceShadowSteps:Math.round(y(t.screenSpaceShadowSteps,e.screenSpaceShadowSteps,1,32)),screenSpaceShadowBias:y(t.screenSpaceShadowBias,e.screenSpaceShadowBias,0,1),screenSpaceShadowMaxDistance:y(t.screenSpaceShadowMaxDistance,e.screenSpaceShadowMaxDistance,1,1e7),screenSpaceShadowThickness:y(t.screenSpaceShadowThickness,e.screenSpaceShadowThickness,.01,1e3),blurPasses:Math.round(y(t.blurPasses,e.blurPasses,0,2)),blurRadius:Math.round(y(t.blurRadius,e.blurRadius,1,6)),blurDepthThreshold:y(t.blurDepthThreshold,e.blurDepthThreshold,1e-4,1),upsampleDepthThreshold:y(t.upsampleDepthThreshold,e.upsampleDepthThreshold,1e-4,1),maxLights:Math.round(y(t.maxLights,e.maxLights,0,K)),maxShadowedLights:Math.round(y(t.maxShadowedLights,e.maxShadowedLights,0,E)),pcfTaps:y(t.pcfTaps,e.pcfTaps,1,4)>=4?4:1,selectionRefreshRate:Math.round(y(t.selectionRefreshRate,e.selectionRefreshRate,1,60)),debugMode:Math.round(y(t.debugMode,e.debugMode,0,3))}}a(Se,"normalizeVolumetricLightingConfiguration");var ii=new WeakSet;function Lo(t){t.metadata??={};let e=t.metadata[se];if(!e||typeof e!="object")return t.metadata[se]=Co(null),ii.add(t.metadata[se]),t.metadata[se];if(ii.has(e))return e;let i=oi();return Object.keys(i).forEach(o=>{e[o]===void 0&&(e[o]=i[o])}),ii.add(e),e}a(Lo,"ensureVolumetricLightConfiguration");function li(t){let e=t.metadata?.[se];return e&&typeof e=="object"?Lo(t):null}a(li,"getVolumetricLightConfiguration");function Hn(t){return t.metadata?.[se]?.enabled===!0}a(Hn,"isVolumetricLightEnabled");var Je=require("babylonjs"),wo=require("babylonjs"),pi=require("babylonjs"),j=require("babylonjs"),mi=(o=>(o[o.Texture2D=0]="Texture2D",o[o.Sampler2DShadow=1]="Sampler2DShadow",o[o.Cube=2]="Cube",o))(mi||{}),Oo=(o=>(o[o.Standard=0]="Standard",o[o.Esm=1]="Esm",o[o.CloseEsm=2]="CloseEsm",o))(Oo||{}),hi=(o=>(o[o.Analytic=0]="Analytic",o[o.AnalyticHeight=1]="AnalyticHeight",o[o.Numeric=2]="Numeric",o))(hi||{}),Do=10,kn=4,Un=22,Wn=32,Xn=.15;function Me(t,e){let i=t.getCaps(),o=i.maxFragmentUniformVectors||224,r=t.isWebGPU?Math.floor(o/4):o,n=Math.max(224,r)-Wn,l=Math.max(8,i.maxTexturesImageUnits||16)-1,p=l>=2,s=p?Un:0,c=Math.max(0,Math.min(E,e.maxShadowedLights,l-(p?1:0),Math.floor((n-s)/Do))),m=Math.max(0,Math.min(K,e.maxLights,Math.floor((n-s-c*Do)/kn)));return{maxShadowSlots:c,maxArrayLights:m,maxDirectionalLights:Math.min(ri,m),allowCsm:p}}a(Me,"computeVolumetricBudget");function Eo(t){let e=[];return t.lights.forEach(i=>{pe(i)?i.lights.forEach(o=>{e.push({light:o,isClustered:!0})}):e.push({light:i,isClustered:!1})}),e}a(Eo,"getAllVolumetricCandidateLights");function To(t,e){let i=t.getShadowGenerator(e.activeCamera)??t.getShadowGenerator();if(!i||!Lt(i))return null;let o=i.getShadowMapForRendering();if(!o?.isReady())return null;let r=i.getShadowMap()?.getSize().width??1024,n=o.textureType===pi.Constants.TEXTURETYPE_UNSIGNED_BYTE,l=!ie(t),p=t.needCube?.()===!0;switch(i.filter){case j.ShadowGenerator.FILTER_PCF:case j.ShadowGenerator.FILTER_PCSS:return{generator:i,kind:p?2:1,mode:0,packed:n,mapSize:r,local:l};case j.ShadowGenerator.FILTER_EXPONENTIALSHADOWMAP:case j.ShadowGenerator.FILTER_BLUREXPONENTIALSHADOWMAP:return{generator:i,kind:p?2:0,mode:1,packed:n,mapSize:r,local:l};case j.ShadowGenerator.FILTER_CLOSEEXPONENTIALSHADOWMAP:case j.ShadowGenerator.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP:return{generator:i,kind:p?2:0,mode:2,packed:n,mapSize:r,local:l};default:return{generator:i,kind:p?2:0,mode:0,packed:n,mapSize:r,local:l}}}a(To,"resolveVolumetricShadowSlot");function et(t,e){let i=t;return i.computeTransformedInformation?.()&&i.transformedPosition?e.copyFrom(i.transformedPosition):i.position?e.copyFrom(i.position):e.copyFromFloats(0,0,0),e}a(et,"getVolumetricLightWorldPosition");function Re(t,e){let i=t;return i.computeTransformedInformation?.()&&i.transformedDirection?e.copyFrom(i.transformedDirection):i.direction?e.copyFrom(i.direction):e.copyFromFloats(0,0,1),e.normalize()}a(Re,"getVolumetricLightWorldDirection");function tt(t,e,i){let o=t.range>0&&t.range<Number.MAX_VALUE?t.range:i.maxDistance;return Math.max(.001,Math.min(o*e.rangeMultiplier,34e37))}a(tt,"getVolumetricLightRange");var ci=new Je.Vector3,_o=new Je.Vector3;function $n(t,e,i){if(et(t,i),!ne(t))return e;let o=Math.cos(t.angle*.5);if(o<=.5)return e;let r=e/(2*o);return Re(t,_o),i.addInPlace(_o.scaleInPlace(r)),r}a($n,"computeVolumetricLightBounds");function Kn(t,e,i){for(let o=0;o<i.length;++o)if(i[o].dotCoordinate(t)<=-e)return!1;return!0}a(Kn,"isSphereInFrustum");function Po(t){return(t.local?64:0)+t.kind*16+t.mode*4+(t.packed?1:0)}a(Po,"getShadowSlotSignature");function di(t,e,i,o,r){let n={candidateCount:0,culledCount:0,shadowedCount:0,unshadowedCount:0,droppedCount:0,perLight:new Map},l=wo.Frustum.GetPlanes(t.getTransformMatrix()),p=e.globalPosition,s=[];Eo(t).forEach(({light:v,isClustered:C})=>{let V=li(v);if(!V?.enabled)return;if(n.candidateCount++,Ye(v)||!v.isEnabled()||v.intensity<=0||V.volumeIntensity<=0){n.perLight.set(v.uniqueId,{state:"disabled",slot:-1,reason:Ye(v)?"Hemispheric lights have no position nor direction and can't produce light shafts.":"The light is disabled or its intensity is zero."});return}let X=ie(v),ce=V.priority*1e3;if(X)ce+=1e6;else{let Ke=Math.min(tt(v,V,i),i.maxDistance),xt=$n(v,Ke,ci);if(!Kn(ci,xt,l)){n.culledCount++,n.perLight.set(v.uniqueId,{state:"culled",slot:-1,reason:"The light is outside of the frustum of the camera and doesn't reach it."});return}let Sn=Math.max(1,Je.Vector3.Distance(ci,p)-xt);ce+=V.volumeIntensity*v.intensity*Math.min(4,xt/Sn)}s.push({light:v,config:V,isClustered:C,typeId:v.getTypeID(),score:ce})}),s.sort((v,C)=>C.score-v.score);let c=new Map;r?.shadowed.forEach((v,C)=>{c.set(v.candidate.light.uniqueId,C)});let m=[],h=[],d=new Map,f=null;s.forEach(v=>{let{light:C,config:V}=v;if(!V.castVolumetricShadows){d.set(C.uniqueId,"occlusion is disabled on this light."),h.push(v);return}if(v.isClustered){d.set(C.uniqueId,"clustered lighting doesn't support shadow maps."),h.push(v);return}if(!C.shadowEnabled||!t.shadowsEnabled){d.set(C.uniqueId,"shadows are disabled on this light or on the scene."),h.push(v);return}let X=C.getShadowGenerator(t.activeCamera)??C.getShadowGenerator();if(!X){d.set(C.uniqueId,"the light has no shadow generator."),h.push(v);return}if(Dt(X)&&o.allowCsm){let Ke=X.getShadowMapForRendering();if(!f&&Ke?.isReady()){f={candidate:v,generator:X,cascades:X.numCascades,kind:X.filter===j.ShadowGenerator.FILTER_PCF||X.filter===j.ShadowGenerator.FILTER_PCSS?1:0,packed:Ke.textureType===pi.Constants.TEXTURETYPE_UNSIGNED_BYTE};return}d.set(C.uniqueId,f?"another light already uses the single cascaded shadow map slot.":"its cascaded shadow map is not ready yet."),h.push(v);return}let ce=To(C,t);if(!ce){d.set(C.uniqueId,"the shadow map of the light is not ready yet."),h.push(v);return}m.push({candidate:v,shadow:ce})});function S(v){let C=v.candidate.score;return c.get(v.candidate.light.uniqueId)===void 0?C:C+Math.abs(C)*Xn}a(S,"getHysteresisScore");function g(v){return c.get(v.candidate.light.uniqueId)??Number.MAX_SAFE_INTEGER}a(g,"getPreviousSlot"),m.sort((v,C)=>{let V=S(C)-S(v);return V!==0?V:g(v)-g(C)});let b=m.slice(0,o.maxShadowSlots);b.sort((v,C)=>Po(v.shadow)-Po(C.shadow)||g(v)-g(C)),m.slice(o.maxShadowSlots).forEach(v=>{d.set(v.candidate.light.uniqueId,"the shadowed lights budget is full."),h.push(v.candidate)}),h.sort((v,C)=>C.score-v.score);let L=[],_=[],x=[];h.forEach(v=>{ie(v.light)?L.length<o.maxDirectionalLights?L.push(v):x.push({candidate:v,reason:`Not rendered: at most ${o.maxDirectionalLights} directional light(s) without a shadow map can take part in the effect.`}):_.push(v)});let R=Math.max(0,o.maxArrayLights-L.length);_.slice(R).forEach(v=>{x.push({candidate:v,reason:'Not rendered: the lights budget is full. Raise "Max Lights" or lower the priority of the other lights.'})});let G=L.concat(_.slice(0,R));if(b.forEach((v,C)=>{n.shadowedCount++,n.perLight.set(v.candidate.light.uniqueId,{state:"shadowed",slot:C,reason:`Casting volumetric shadows using slot ${C+1} of ${o.maxShadowSlots}.`})}),f){let v=f;n.shadowedCount++,n.perLight.set(v.candidate.light.uniqueId,{state:"shadowed",slot:-1,reason:`Casting volumetric shadows using its ${v.cascades} shadow cascades.`})}return G.forEach(v=>{n.unshadowedCount++;let C=v.config.castVolumetricShadows?"Occluded using the depth buffer":"Not occluded by the geometry",V=d.get(v.light.uniqueId)??"the light has no shadow map.";n.perLight.set(v.light.uniqueId,{state:"unshadowed",slot:-1,reason:`${C}: ${V}`})}),x.forEach(({candidate:v,reason:C})=>{n.droppedCount++,n.perLight.set(v.light.uniqueId,{state:"dropped",slot:-1,reason:C})}),{shadowed:b,unshadowed:G,directionalCount:L.length,csm:f,stats:n}}a(di,"selectVolumetricLights");function jn(t,e,i){let o=t.shadowed.map(n=>`${n.shadow.kind}.${n.shadow.mode}.${n.shadow.packed?1:0}.${n.shadow.local?1:0}`).join("|"),r=t.csm?`${t.csm.kind}.${t.csm.cascades}.${t.csm.packed?1:0}`:"-";return[e.steps,i.lightSteps,e.stepDistribution,e.ditherMode,e.temporalJitter?1:0,e.heightFogEnabled?1:0,e.lightExtinctionEnabled?1:0,e.pcfTaps,e.blurRadius,e.debugMode,e.screenSpaceShadows?e.screenSpaceShadowSteps:0,i.fogMode,i.transmittance,i.depthMode,i.ldrEncode?1:0,i.reverseDepth?1:0,i.ndcHalfZ?1:0,i.linearDepthPacked?1:0,i.arrayLightCapacity,t.directionalCount,o,r].join(",")}a(jn,"computeVolumetricShapeKey");function Zn(t){return Ct(t)||ne(t)||ie(t)}a(Zn,"isVolumetricLightSupported");var fi=require("babylonjs"),Yn=0,ui=(o=>(o[o.DepthRenderer=0]="DepthRenderer",o[o.GeometryBuffer=1]="GeometryBuffer",o[o.PrePass=2]="PrePass",o))(ui||{}),Ao="volumetricLighting";function gi(){return{name:Ao,enabled:!1,texturesRequired:[fi.Constants.PREPASS_DEPTH_TEXTURE_TYPE]}}a(gi,"createVolumetricLightingPrePassConfiguration");function ye(t){return t.prePassRenderer??null}a(ye,"getVolumetricPrePassRenderer");function Ve(t){return t.geometryBufferRenderer??null}a(Ve,"getVolumetricGeometryBufferRenderer");function Io(t){let e=t.getCaps();return e.textureFloat&&e.textureFloatLinearFiltering||e.textureHalfFloat&&e.textureHalfFloatLinearFiltering}a(Io,"supportsVolumetricFloatDepthTexture");function it(t){return Io(t.getEngine())?ye(t)?.isSupported?2:Ve(t)?.isSupported?1:0:0}a(it,"resolveVolumetricDepthSource");function vi(t){let e=t.getIndex(fi.Constants.PREPASS_DEPTH_TEXTURE_TYPE);return e===void 0||e<0?null:t.getRenderTarget()?.textures?.[e]??null}a(vi,"getVolumetricPrePassDepthTexture");function Si(t){if(!t.enableDepth)return null;let e=t.getTextureIndex(Yn);return e<0?null:t.getGBuffer()?.textures?.[e]??null}a(Si,"getVolumetricGeometryBufferDepthTexture");var ot=`
1
+ var je=Object.defineProperty;var yn=Object.getOwnPropertyDescriptor;var bn=Object.getOwnPropertyNames;var xn=Object.prototype.hasOwnProperty;var a=(t,e)=>je(t,"name",{value:e,configurable:!0});var Cn=(t,e)=>{for(var i in e)je(t,i,{get:e[i],enumerable:!0})},Ln=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of bn(e))!xn.call(t,r)&&r!==i&&je(t,r,{get:()=>e[r],enumerable:!(o=yn(e,r))||o.enumerable});return t};var Dn=t=>Ln(je({},"__esModule",{value:!0}),t);var ls={};Cn(ls,{AdvancedAssetContainer:()=>ze,AdvancedAssetContainerInstantiatedEntries:()=>Be,Cinematic:()=>We,Database:()=>$e,NodeParticleSystemSet:()=>an.NodeParticleSystemSet,VolumetricDebugMode:()=>xo,VolumetricDepthSource:()=>ui,VolumetricDitherMode:()=>ni,VolumetricFogMode:()=>ai,VolumetricLightingRenderingPipeline:()=>Y,VolumetricShadowKind:()=>mi,VolumetricShadowMode:()=>Oo,VolumetricStepDistribution:()=>bo,VolumetricTransmittanceMode:()=>hi,_applyScriptsForObject:()=>G,_getKtx2TextureName:()=>ft,_preloadScriptsAssets:()=>Vi,_registerScriptInstance:()=>Gi,_removeRegisteredScriptInstance:()=>mt,addExcludedCompressedTexture:()=>ut,animationFromSprite:()=>Qa,animationGroupFromScene:()=>Ma,applyMeshesLODQuality:()=>It,applyRagdollJointLimits:()=>va,applyRenderingConfigurationForCamera:()=>_i,applyScriptOnObject:()=>Ca,applyShadowsQuality:()=>An,applyTexturesQuality:()=>_a,canUseHdr:()=>ga,componentFromScene:()=>Aa,computeVolumetricBudget:()=>Me,computeVolumetricShapeKey:()=>jn,configureEngineToUseCompressedTextures:()=>Da,configureMeshDistanceOrScreenCoverage:()=>At,configureShadowMapRefreshRate:()=>qe,configureShadowMapRenderListPredicate:()=>Mt,copyAndParseRagdollConfiguration:()=>Oi,createAndOpenDatabase:()=>Yi,createDefaultRenderingPipeline:()=>yo,createMotionBlurPostProcess:()=>fo,createSSAO2RenderingPipeline:()=>mo,createSSRRenderingPipeline:()=>so,createTAARenderingPipeline:()=>co,createVLSPostProcess:()=>no,createVolumetricLightingPrePassConfiguration:()=>gi,createVolumetricLightingRenderingPipeline:()=>Xo,defaultPipelineCameraConfigurations:()=>ve,disposeDefaultRenderingPipeline:()=>Qt,disposeMotionBlurPostProcess:()=>jt,disposeSSAO2RenderingPipeline:()=>Wt,disposeSSRRenderingPipeline:()=>Gt,disposeTAARenderingPipeline:()=>Ht,disposeVLSPostProcess:()=>Vt,disposeVolumetricLightingRenderingPipeline:()=>Ci,ensureVolumetricLightConfiguration:()=>Lo,forceCompileAllSceneMaterials:()=>Ea,generateCinematicAnimationGroup:()=>os,getAllScriptsByClassForObject:()=>Pe,getAllVolumetricCandidateLights:()=>Eo,getAnimationTypeForObject:()=>Ue,getDefaultRenderingPipeline:()=>Ie,getDefaultVolumetricLightConfiguration:()=>oi,getDefaultVolumetricLightingConfiguration:()=>Qe,getFromIndexDB:()=>Xe,getHdrTextureType:()=>X,getMotionBlurPostProcess:()=>Kt,getPowerOfTwoUntil:()=>F,getSSAO2RenderingPipeline:()=>Nn,getSSRRenderingPipeline:()=>Mn,getScriptByClassForObject:()=>Ni,getTAARenderingPipeline:()=>Vn,getTextureUrl:()=>gt,getVLSPostProcess:()=>Rt,getVolumetricGeometryBufferDepthTexture:()=>Si,getVolumetricGeometryBufferRenderer:()=>Ve,getVolumetricLightConfiguration:()=>li,getVolumetricLightRange:()=>tt,getVolumetricLightSteps:()=>si,getVolumetricLightWorldDirection:()=>Re,getVolumetricLightWorldPosition:()=>et,getVolumetricLightingRenderingPipeline:()=>ma,getVolumetricPrePassDepthTexture:()=>vi,getVolumetricPrePassRenderer:()=>ye,guiFromAsset:()=>Va,isAbstractMesh:()=>oe,isAnyParticleSystem:()=>wt,isArcRotateCamera:()=>On,isBone:()=>_n,isCamera:()=>Ze,isCascadedShadowGenerator:()=>Dt,isCinematicGroup:()=>ts,isCinematicKey:()=>ji,isCinematicKeyCut:()=>Oe,isCinematicKeyEvent:()=>es,isCinematicSound:()=>is,isClusteredLightContainer:()=>pe,isDecalMesh:()=>Ji,isDirectionalLight:()=>te,isFreeCamera:()=>wn,isGPUParticleSystem:()=>En,isGaussianSplattingMesh:()=>Et,isGroundMesh:()=>Pn,isHemisphericLight:()=>Ye,isInstancedMesh:()=>Te,isLight:()=>Qi,isMesh:()=>V,isNode:()=>me,isNodeFromStaticGroup:()=>Tt,isParticleSystem:()=>Pt,isPointLight:()=>Ct,isScene:()=>_t,isShadowGenerator:()=>Lt,isSoundNode:()=>ne,isSpotLight:()=>re,isSprite:()=>Ot,isTexture:()=>Ae,isTransformNode:()=>ee,isUsingKtx2CompressedTextures:()=>ke,isVolumetricLightEnabled:()=>Hn,isVolumetricLightSupported:()=>Zn,isVolumetricLightingSupported:()=>da,loadMaterialFromFile:()=>Oa,loadScene:()=>wa,markVolumetricLightsDirty:()=>fa,maxVolumetricArrayLights:()=>$,maxVolumetricDirectionalLights:()=>ri,maxVolumetricShadowSlots:()=>E,motionBlurPostProcessCameraConfigurations:()=>ge,nodeFromDescendants:()=>Ia,nodeFromScene:()=>Ta,normalizeAtlasJson:()=>zi,normalizeVolumetricLightConfiguration:()=>Co,normalizeVolumetricLightingConfiguration:()=>Se,onKeyboardEvent:()=>Ya,onPointerEvent:()=>Za,openIndexDB:()=>Zi,parseCinematic:()=>Ja,parseCinematicKeyValue:()=>H,parseDefaultRenderingPipeline:()=>ei,parseKeyFrameAnimations:()=>$i,parseMotionBlurPostProcess:()=>Yt,parseRagdollConfiguration:()=>Qo,parseSSAO2RenderingPipeline:()=>$t,parseSSRRenderingPipeline:()=>zt,parseTAARenderingPipeline:()=>Ut,parseVLSPostProcess:()=>Nt,parseVolumetricLightingRenderingPipeline:()=>Di,particleSystemFromScene:()=>Na,playSpriteAnimationFromName:()=>Pa,preloadAssetsToDatabase:()=>ss,putInIndexDB:()=>U,registerScriptAssetParser:()=>xa,resolveVolumetricDepthSource:()=>it,resolveVolumetricShadowSlot:()=>To,saveRenderingConfigurationForCamera:()=>ua,sceneAsset:()=>Ra,scriptAssetsCache:()=>le,scriptAssetsParsers:()=>He,scriptsDictionary:()=>z,selectVolumetricLights:()=>di,serializeDefaultRenderingPipeline:()=>Jt,serializeMotionBlurPostProcess:()=>Zt,serializeSSAO2RenderingPipeline:()=>Xt,serializeSSRRenderingPipeline:()=>Bt,serializeTAARenderingPipeline:()=>kt,serializeVLSPostProcess:()=>Ft,serializeVolumetricLightingRenderingPipeline:()=>Li,setDefaultRenderingPipelineRef:()=>zn,setMotionBlurPostProcessRef:()=>Bn,setSSAO2RenderingPipelineRef:()=>Gn,setSSRRenderingPipelineRef:()=>Rn,setStaticDecalsEnabled:()=>Tn,setTAARenderingPipelineRef:()=>Fn,setUseKtx2CompressedTextures:()=>La,setVLSPostProcessRef:()=>In,setVolumetricLightingRenderingPipelineRef:()=>ha,setupOfflineProvider:()=>rs,soundFromScene:()=>Fa,spriteFromSpriteManager:()=>qa,ssaoRenderingPipelineCameraConfigurations:()=>ue,ssrRenderingPipelineCameraConfigurations:()=>de,supportsVolumetricFloatDepthTexture:()=>Io,taaRenderingPipelineCameraConfigurations:()=>fe,visibleAsAsset:()=>ja,visibleAsBoolean:()=>Ga,visibleAsColor3:()=>Ua,visibleAsColor4:()=>Wa,visibleAsEntity:()=>Xa,visibleAsKeyMap:()=>Ka,visibleAsNumber:()=>za,visibleAsString:()=>Ba,visibleAsTexture:()=>$a,visibleAsVector2:()=>Ha,visibleAsVector3:()=>ka,vlsPostProcessCameraConfigurations:()=>he,volumetricLightMetadataKey:()=>ae,volumetricLightingPrePassConfigurationName:()=>Ao,volumetricLightingRenderingPipelineCameraConfigurations:()=>xe});module.exports=Dn(ls);function oe(t){switch(t.getClassName?.()){case"Mesh":case"LineMesh":case"GroundMesh":case"InstancedMesh":return!0}return!1}a(oe,"isAbstractMesh");function V(t){switch(t.getClassName?.()){case"Mesh":case"GroundMesh":return!0}return!1}a(V,"isMesh");function Te(t){return t.getClassName?.()==="InstancedMesh"}a(Te,"isInstancedMesh");function _n(t){return t.getClassName?.()==="Bone"}a(_n,"isBone");function Pn(t){return t.getClassName?.()==="GroundMesh"}a(Pn,"isGroundMesh");function ee(t){return t.getClassName?.()==="TransformNode"}a(ee,"isTransformNode");function Ae(t){return t?.getClassName?.()==="Texture"}a(Ae,"isTexture");function Ze(t){switch(t.getClassName?.()){case"Camera":case"FreeCamera":case"TargetCamera":case"EditorCamera":case"ArcRotateCamera":case"UniversalCamera":return!0}return!1}a(Ze,"isCamera");function wn(t){switch(t.getClassName?.()){case"FreeCamera":case"UniversalCamera":return!0}return!1}a(wn,"isFreeCamera");function On(t){return t.getClassName?.()==="ArcRotateCamera"}a(On,"isArcRotateCamera");function Ct(t){return t.getClassName?.()==="PointLight"}a(Ct,"isPointLight");function te(t){return t.getClassName?.()==="DirectionalLight"}a(te,"isDirectionalLight");function re(t){return t.getClassName?.()==="SpotLight"}a(re,"isSpotLight");function Ye(t){return t.getClassName?.()==="HemisphericLight"}a(Ye,"isHemisphericLight");function Qi(t){switch(t.getClassName?.()){case"Light":case"PointLight":case"SpotLight":case"DirectionalLight":case"HemisphericLight":return!0}return!1}a(Qi,"isLight");function Lt(t){return t.getClassName?.()==="ShadowGenerator"}a(Lt,"isShadowGenerator");function Dt(t){return t.getClassName?.()==="CascadedShadowGenerator"}a(Dt,"isCascadedShadowGenerator");function pe(t){return t.getClassName?.()==="ClusteredLightContainer"}a(pe,"isClusteredLightContainer");function me(t){return oe(t)||ee(t)||Qi(t)||Ze(t)}a(me,"isNode");function _t(t){return t.getClassName?.()==="Scene"}a(_t,"isScene");function Pt(t){return t.getClassName?.()==="ParticleSystem"}a(Pt,"isParticleSystem");function En(t){return t.getClassName?.()==="GPUParticleSystem"}a(En,"isGPUParticleSystem");function wt(t){switch(t.getClassName?.()){case"ParticleSystem":case"GPUParticleSystem":return!0}return!1}a(wt,"isAnyParticleSystem");function Ot(t){return t.getClassName?.()==="Sprite"}a(Ot,"isSprite");function ne(t){return t.getClassName?.()==="SoundNode"}a(ne,"isSoundNode");function Et(t){return t.getClassName?.()==="GaussianSplattingMesh"}a(Et,"isGaussianSplattingMesh");function Tt(t){let e=t;for(;e;){if(e.metadata?.isStaticGroup)return!0;e=e.parent}return!1}a(Tt,"isNodeFromStaticGroup");function At(t){t.meshes.forEach(e=>{V(e)&&e.getLODLevels().forEach(i=>{i.mesh&&(i.mesh.originalDistanceOrScreenCoverage=i.distanceOrScreenCoverage)})})}a(At,"configureMeshDistanceOrScreenCoverage");function It(t,e){e.meshes.forEach(i=>{V(i)&&i.getLODLevels().forEach(o=>{if(o.mesh?.originalDistanceOrScreenCoverage)switch(t){case"very-low":o.distanceOrScreenCoverage=o.mesh.originalDistanceOrScreenCoverage*.125;break;case"low":o.distanceOrScreenCoverage=o.mesh.originalDistanceOrScreenCoverage*.25;break;case"medium":o.distanceOrScreenCoverage=o.mesh.originalDistanceOrScreenCoverage*.5;break;case"high":o.distanceOrScreenCoverage=o.mesh.originalDistanceOrScreenCoverage;break}})})}a(It,"applyMeshesLODQuality");function Ji(t){return(t.metadata?.decal??null)!==null}a(Ji,"isDecalMesh");function Tn(t,e){e.meshes.forEach(i=>{Ji(i)&&Tt(i)&&i.setEnabled(t)})}a(Tn,"setStaticDecalsEnabled");function F(t){let e=1;for(;e<=t;)e<<=1;return e>>1}a(F,"getPowerOfTwoUntil");var eo=require("babylonjs"),to=require("babylonjs");function Mt(t){t.lights.forEach(e=>{let i=e.getShadowGenerator()?.getShadowMap();i&&(i.renderListPredicate=o=>Et(o)?!1:eo.Vector3.Distance(o.getAbsolutePosition(),e.getAbsolutePosition())<=e.range)})}a(Mt,"configureShadowMapRenderListPredicate");async function qe(t){t.executeWhenReady(()=>{t.lights.forEach(e=>{let i=e.getShadowGenerator()?.getShadowMap();i&&(i.refreshRate=e.metadata?.refreshRate??to.RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME)})})}a(qe,"configureShadowMapRefreshRate");function An(t,e){e.lights.forEach(i=>{let o=i.getShadowGenerator(),r=o?.getShadowMap();if(o?.originalMapSize){let n=o.originalMapSize;switch(t){case"medium":n=n*.5;break;case"low":n=n*.25;break;case"very-low":n=n*.125;break}n=Math.max(128,F(n)),r?.getSize().width!==n&&r.resize(n)}}),qe(e)}a(An,"applyShadowsQuality");var io=require("babylonjs"),oo=require("babylonjs"),ro=require("babylonjs"),w=null,he=new Map;function Rt(){return w}a(Rt,"getVLSPostProcess");function In(t){w=t}a(In,"setVLSPostProcessRef");function Vt(t){w&&t.activeCamera&&(w.dispose(t.activeCamera),w=null)}a(Vt,"disposeVLSPostProcess");function no(t,e,i){return e??=t.meshes.find(o=>V(o)),w=new ro.VolumetricLightScatteringPostProcess("VolumetricLightScatteringPostProcess",1,t.activeCamera,e,100,oo.Texture.BILINEAR_SAMPLINGMODE,t.getEngine(),!1),w.samples=i?.msaaSamples??1,w}a(no,"createVLSPostProcess");function Ft(){return w?{meshId:w.mesh?.id,exposure:w.exposure,decay:w.decay,weight:w.weight,density:w.density,invert:w.invert,useCustomMeshPosition:w.useCustomMeshPosition,customMeshPosition:w.customMeshPosition.asArray()}:null}a(Ft,"serializeVLSPostProcess");function Nt(t,e,i){let o=null;if(e.meshId){let n=t.getMeshById(e.meshId);n&&V(n)&&(o=n)}let r=w??no(t,o,i);return r.samples=i?.msaaSamples??1,r.exposure=e.exposure,r.decay=e.decay,r.weight=e.weight,r.density=e.density,r.invert=e.invert,r.useCustomMeshPosition=e.useCustomMeshPosition,r.customMeshPosition.copyFrom(io.Vector3.FromArray(e.customMeshPosition)),r}a(Nt,"parseVLSPostProcess");var ao=require("babylonjs"),D=null,de=new Map;function Mn(){return D}a(Mn,"getSSRRenderingPipeline");function Rn(t){D=t}a(Rn,"setSSRRenderingPipelineRef");function Gt(){D&&(D.dispose(),D=null)}a(Gt,"disposeSSRRenderingPipeline");function so(t,e,i){return D=new ao.SSRRenderingPipeline("SSRRenderingPipeline",t,[e],void 0,X(t.getEngine())),D.samples=i?.msaaSamples??1,D}a(so,"createSSRRenderingPipeline");function Bt(){return D?{samples:D.samples,step:D.step,thickness:D.thickness,strength:D.strength,reflectionSpecularFalloffExponent:D.reflectionSpecularFalloffExponent,maxSteps:D.maxSteps,maxDistance:D.maxDistance,roughnessFactor:D.roughnessFactor,reflectivityThreshold:D.reflectivityThreshold,blurDispersionStrehgth:D.blurDispersionStrength,clipToFrustum:D.clipToFrustum,enableSmoothReflections:D.enableSmoothReflections,enableAutomaticThicknessComputation:D.enableAutomaticThicknessComputation,attenuateFacingCamera:D.attenuateFacingCamera,attenuateScreenBorders:D.attenuateScreenBorders,attenuateIntersectionDistance:D.attenuateIntersectionDistance,attenuateBackfaceReflection:D.attenuateBackfaceReflection,blurDownsample:D.blurDownsample,selfCollisionNumSkip:D.selfCollisionNumSkip,ssrDownsample:D.ssrDownsample,backfaceDepthTextureDownsample:D.backfaceDepthTextureDownsample}:null}a(Bt,"serializeSSRRenderingPipeline");function zt(t,e,i,o){let r=D??so(t,e,o);return r.samples=o?.msaaSamples??1,r.step=i.step,r.thickness=i.thickness,r.strength=i.strength,r.reflectionSpecularFalloffExponent=i.reflectionSpecularFalloffExponent,r.maxSteps=i.maxSteps,r.maxDistance=i.maxDistance,r.roughnessFactor=i.roughnessFactor,r.reflectivityThreshold=i.reflectivityThreshold,r.blurDispersionStrength=i.blurDispersionStrehgth,r.clipToFrustum=i.clipToFrustum,r.enableSmoothReflections=i.enableSmoothReflections,r.enableAutomaticThicknessComputation=i.enableAutomaticThicknessComputation,r.attenuateFacingCamera=i.attenuateFacingCamera,r.attenuateScreenBorders=i.attenuateScreenBorders,r.attenuateIntersectionDistance=i.attenuateIntersectionDistance,r.attenuateBackfaceReflection=i.attenuateBackfaceReflection,r.blurDownsample=i.blurDownsample,r.selfCollisionNumSkip=i.selfCollisionNumSkip,r.ssrDownsample=i.ssrDownsample,r.backfaceDepthTextureDownsample=i.backfaceDepthTextureDownsample,r}a(zt,"parseSSRRenderingPipeline");var lo=require("babylonjs"),T=null,fe=new Map;function Vn(){return T}a(Vn,"getTAARenderingPipeline");function Fn(t){T=t}a(Fn,"setTAARenderingPipelineRef");function Ht(){T&&(T.dispose(),T=null)}a(Ht,"disposeTAARenderingPipeline");function co(t,e,i){return T=new lo.TAARenderingPipeline("TAARenderingPipeline",t,[e],X(t.getEngine())),T.msaaSamples=i?.msaaSamples??1,T}a(co,"createTAARenderingPipeline");function kt(){return T?{factor:T.factor,samples:T.samples,clampHistory:T.clampHistory,reprojectHistory:T.reprojectHistory,disableOnCameraMove:T.disableOnCameraMove}:null}a(kt,"serializeTAARenderingPipeline");function Ut(t,e,i,o){let r=T??co(t,e,o);return r.msaaSamples=o?.msaaSamples??1,r.factor=i.factor,r.clampHistory=i.clampHistory,r.reprojectHistory=i.reprojectHistory,r.disableOnCameraMove=i.disableOnCameraMove,r}a(Ut,"parseTAARenderingPipeline");var po=require("babylonjs"),P=null,ue=new Map;function Nn(){return P}a(Nn,"getSSAO2RenderingPipeline");function Gn(t){P=t}a(Gn,"setSSAO2RenderingPipelineRef");function Wt(){P&&(P.dispose(),P=null)}a(Wt,"disposeSSAO2RenderingPipeline");function mo(t,e,i){return P=new po.SSAO2RenderingPipeline("SSAO2RenderingPipeline",t,1,[e],void 0,X(t.getEngine())),P.textureSamples=1,P}a(mo,"createSSAO2RenderingPipeline");function Xt(){return P?{radius:P.radius,totalStrength:P.totalStrength,samples:P.samples,maxZ:P.maxZ,minZAspect:P.minZAspect,epsilon:P.epsilon,textureSamples:P.textureSamples,bypassBlur:P.bypassBlur,bilateralSamples:P.bilateralSamples,bilateralSoften:P.bilateralSoften,bilateralTolerance:P.bilateralTolerance,expensiveBlur:P.expensiveBlur}:null}a(Xt,"serializeSSAO2RenderingPipeline");function $t(t,e,i,o){let r=P??mo(t,e,o);return r.textureSamples=1,r.radius=i.radius,r.totalStrength=i.totalStrength,r.samples=i.samples,r.maxZ=i.maxZ,r.minZAspect=i.minZAspect,r.epsilon=i.epsilon,r.bypassBlur=i.bypassBlur,r.bilateralSamples=i.bilateralSamples,r.bilateralSoften=i.bilateralSoften,r.bilateralTolerance=i.bilateralTolerance,r.expensiveBlur=i.expensiveBlur,r}a($t,"parseSSAO2RenderingPipeline");var ho=require("babylonjs"),A=null,ge=new Map;function Kt(){return A}a(Kt,"getMotionBlurPostProcess");function Bn(t){A=t}a(Bn,"setMotionBlurPostProcessRef");function jt(){A&&(A.dispose(),A=null)}a(jt,"disposeMotionBlurPostProcess");function fo(t,e,i){return A=new ho.MotionBlurPostProcess("MotionBlurPostProcess",t,1,e,void 0,void 0,void 0,X(t.getEngine())),A.samples=i?.msaaSamples??1,A.motionStrength=1,A.isObjectBased=!0,A}a(fo,"createMotionBlurPostProcess");function Zt(){return A?{isObjectBased:A.isObjectBased,motionStrength:A.motionStrength,motionBlurSamples:A.motionBlurSamples}:null}a(Zt,"serializeMotionBlurPostProcess");function Yt(t,e,i,o){let r=A??fo(t,e,o);return r.samples=o?.msaaSamples??1,r.isObjectBased=i.isObjectBased,r.motionStrength=i.motionStrength,r.motionBlurSamples=i.motionBlurSamples,r}a(Yt,"parseMotionBlurPostProcess");var uo=require("babylonjs"),qt=require("babylonjs"),go=require("babylonjs"),vo=require("babylonjs"),So=require("babylonjs"),g=null,ve=new Map;function Ie(){return g}a(Ie,"getDefaultRenderingPipeline");function zn(t){g=t}a(zn,"setDefaultRenderingPipelineRef");function Qt(){g&&(g.dispose(),g=null)}a(Qt,"disposeDefaultRenderingPipeline");function yo(t,e,i){return g=new So.DefaultRenderingPipeline("DefaultRenderingPipeline",!0,t,[e]),g.samples=i?.msaaSamples??1,g.depthOfField.lensSize=512,g.depthOfField.fStop=.25,g.depthOfField.focusDistance=55e3,g}a(yo,"createDefaultRenderingPipeline");function Jt(){return g?{samples:g.samples,fxaaEnabled:g.fxaaEnabled,imageProcessingEnabled:g.imageProcessingEnabled,exposure:g.imageProcessing?.exposure,contrast:g.imageProcessing?.contrast,fromLinearSpace:g.imageProcessing?.fromLinearSpace,toneMappingEnabled:g.imageProcessing?.toneMappingEnabled,toneMappingType:g.imageProcessing?.toneMappingType,ditheringEnabled:g.imageProcessing?.ditheringEnabled,ditheringIntensity:g.imageProcessing?.ditheringIntensity,bloomEnabled:g.bloomEnabled,bloomThreshold:g.bloomThreshold,bloomWeight:g.bloomWeight,bloomScale:g.bloomScale,bloomKernel:g.bloomKernel,sharpenEnabled:g.sharpenEnabled,sharpenEdgeAmount:g.sharpen.edgeAmount,sharpenColorAmount:g.sharpen.colorAmount,grainEnabled:g.grainEnabled,grainIntensity:g.grain.intensity,grainAnimated:g.grain.animated,depthOfFieldEnabled:g.depthOfFieldEnabled,depthOfFieldBlurLevel:g.depthOfFieldBlurLevel,lensSize:g.depthOfField.lensSize,fStop:g.depthOfField.fStop,focusDistance:g.depthOfField.focusDistance,focalLength:g.depthOfField.focalLength,vignetteEnabled:g.imageProcessing?.vignetteEnabled,vignetteColor:g.imageProcessing?.vignetteColor.asArray(),vignetteWeight:g.imageProcessing?.vignetteWeight,chromaticAberrationEnabled:g.chromaticAberrationEnabled,aberrationAmount:g.chromaticAberration.aberrationAmount,radialIntensity:g.chromaticAberration.radialIntensity,direction:g.chromaticAberration.direction.asArray(),centerPosition:g.chromaticAberration.centerPosition.asArray(),glowLayerEnabled:g.glowLayerEnabled,glowLayerIntensity:g.glowLayer?.intensity,glowLayerBlurKernelSize:g.glowLayer?.blurKernelSize,colorGradingEnabled:g.imageProcessing.colorGradingEnabled,colorGradingTexture:g.imageProcessing.colorGradingTexture?.serialize(),colorGradingWithGreenDepth:g.imageProcessing.imageProcessingConfiguration.colorGradingWithGreenDepth,colorCurvesEnabled:g.imageProcessing.colorCurvesEnabled,globalHue:g.imageProcessing.colorCurves?.globalHue,globalDensity:g.imageProcessing.colorCurves?.globalDensity,globalExposure:g.imageProcessing.colorCurves?.globalExposure,globalSaturation:g.imageProcessing.colorCurves?.globalSaturation,highlightsHue:g.imageProcessing.colorCurves?.highlightsHue,highlightsDensity:g.imageProcessing.colorCurves?.highlightsDensity,highlightsExposure:g.imageProcessing.colorCurves?.highlightsExposure,highlightsSaturation:g.imageProcessing.colorCurves?.highlightsSaturation,midtonesHue:g.imageProcessing.colorCurves?.midtonesHue,midtonesDensity:g.imageProcessing.colorCurves?.midtonesDensity,midtonesExposure:g.imageProcessing.colorCurves?.midtonesExposure,midtonesSaturation:g.imageProcessing.colorCurves?.midtonesSaturation,shadowsHue:g.imageProcessing.colorCurves?.shadowsHue,shadowsDensity:g.imageProcessing.colorCurves?.shadowsDensity,shadowsExposure:g.imageProcessing.colorCurves?.shadowsExposure,shadowsSaturation:g.imageProcessing.colorCurves?.shadowsSaturation}:null}a(Jt,"serializeDefaultRenderingPipeline");function ei(t,e,i,o,r){let n=g??yo(t,e,r);if(n.samples=r?.msaaSamples??1,n.fxaaEnabled=i.fxaaEnabled,n.imageProcessingEnabled=i.imageProcessingEnabled,n.imageProcessing){if(n.imageProcessing.exposure=i.exposure,n.imageProcessing.contrast=i.contrast,n.imageProcessing.fromLinearSpace=i.fromLinearSpace,n.imageProcessing.toneMappingEnabled=i.toneMappingEnabled,n.imageProcessing.toneMappingType=i.toneMappingType,n.imageProcessing.ditheringEnabled=i.ditheringEnabled,n.imageProcessing.ditheringIntensity=i.ditheringIntensity,n.imageProcessing.vignetteEnabled=i.vignetteEnabled??!1,n.imageProcessing.vignetteColor=uo.Color4.FromArray(i.vignetteColor??[0,0,0]),n.imageProcessing.vignetteWeight=i.vignetteWeight??.3,n.imageProcessing.colorGradingEnabled=i.colorGradingEnabled??!1,n.imageProcessing.imageProcessingConfiguration.colorGradingWithGreenDepth=i.colorGradingWithGreenDepth??!0,i.colorGradingTexture){let l=null;if(i.colorGradingTexture.customType==="BABYLON.ColorGradingTexture"){let p=o+i.colorGradingTexture.name;l=new vo.ColorGradingTexture(p,t),l.level=i.colorGradingTexture.level}else{let p=go.Texture.Parse(i.colorGradingTexture,t,o);Ae(p)&&(l=p)}n.imageProcessing.colorGradingTexture=l}n.imageProcessing.colorCurvesEnabled=i.colorCurvesEnabled??!1,n.imageProcessing.colorCurves&&(n.imageProcessing.colorCurves.globalHue=i.globalHue??30,n.imageProcessing.colorCurves.globalDensity=i.globalDensity??0,n.imageProcessing.colorCurves.globalExposure=i.globalExposure??0,n.imageProcessing.colorCurves.globalSaturation=i.globalSaturation??0,n.imageProcessing.colorCurves.highlightsHue=i.highlightsHue??30,n.imageProcessing.colorCurves.highlightsDensity=i.highlightsDensity??0,n.imageProcessing.colorCurves.highlightsExposure=i.highlightsExposure??0,n.imageProcessing.colorCurves.highlightsSaturation=i.highlightsSaturation??0,n.imageProcessing.colorCurves.midtonesHue=i.midtonesHue??30,n.imageProcessing.colorCurves.midtonesDensity=i.midtonesDensity??0,n.imageProcessing.colorCurves.midtonesExposure=i.midtonesExposure??0,n.imageProcessing.colorCurves.midtonesSaturation=i.midtonesSaturation??0,n.imageProcessing.colorCurves.shadowsHue=i.shadowsHue??30,n.imageProcessing.colorCurves.shadowsDensity=i.shadowsDensity??0,n.imageProcessing.colorCurves.shadowsExposure=i.shadowsExposure??0,n.imageProcessing.colorCurves.shadowsSaturation=i.shadowsSaturation??0)}return n.bloomEnabled=i.bloomEnabled,n.bloomThreshold=i.bloomThreshold,n.bloomWeight=i.bloomWeight,n.bloomScale=i.bloomScale,n.bloomKernel=i.bloomKernel,n.sharpenEnabled=i.sharpenEnabled,n.sharpen.edgeAmount=i.sharpenEdgeAmount,n.sharpen.colorAmount=i.sharpenColorAmount,n.grainEnabled=i.grainEnabled,n.grain.intensity=i.grainIntensity,n.grain.animated=i.grainAnimated,n.depthOfFieldEnabled=i.depthOfFieldEnabled,n.depthOfFieldBlurLevel=i.depthOfFieldBlurLevel,n.depthOfField.lensSize=i.lensSize,n.depthOfField.fStop=i.fStop,n.depthOfField.focusDistance=i.focusDistance,n.depthOfField.focalLength=i.focalLength,n.chromaticAberrationEnabled=i.chromaticAberrationEnabled??!1,n.chromaticAberration.aberrationAmount=i.aberrationAmount??10,n.chromaticAberration.radialIntensity=i.radialIntensity??1,n.chromaticAberration.direction=qt.Vector2.FromArray(i.direction??[0,0]),n.chromaticAberration.centerPosition=qt.Vector2.FromArray(i.centerPosition??[0,0]),n.glowLayerEnabled=i.glowLayerEnabled??!1,n.glowLayer&&(n.glowLayer.intensity=i.glowLayerIntensity??1,n.glowLayer.blurKernelSize=i.glowLayerBlurKernelSize??32),n}a(ei,"parseDefaultRenderingPipeline");var ae="volumetricLighting",E=8,$=256,ri=4,bo=(i=>(i[i.Linear=0]="Linear",i[i.Exponential=1]="Exponential",i))(bo||{}),ni=(o=>(o[o.None=0]="None",o[o.Bayer=1]="Bayer",o[o.InterleavedGradientNoise=2]="InterleavedGradientNoise",o))(ni||{}),ai=(o=>(o[o.Exponential=0]="Exponential",o[o.ExponentialSquared=1]="ExponentialSquared",o[o.Linear=2]="Linear",o))(ai||{}),xo=(r=>(r[r.None=0]="None",r[r.Scattering=1]="Scattering",r[r.Transmittance=2]="Transmittance",r[r.LightCount=3]="LightCount",r))(xo||{});function oi(){return{enabled:!1,volumeIntensity:1,anisotropy:.35,useCustomColor:!1,color:[1,1,1],castVolumetricShadows:!0,shadowDarkness:1,rangeMultiplier:1,priority:0}}a(oi,"getDefaultVolumetricLightConfiguration");function Qe(){return{steps:40,lightSteps:0,resolutionScale:.5,stepDistribution:1,ditherMode:2,ditherStrength:1,temporalJitter:!1,fogMode:0,fogDensity:5e-4,fogStart:0,fogEnd:2e3,fogColor:[1,1,1],albedo:1,maxDistance:1e4,heightFogEnabled:!1,heightFogBaseHeight:0,heightFogFalloff:.01,intensity:1.5,lightExtinctionEnabled:!0,lightExtinctionClamp:1e3,extinctionAmount:0,ambientColor:[1,1,1],ambientIntensity:0,screenSpaceShadows:!0,screenSpaceShadowSteps:6,screenSpaceShadowBias:.02,screenSpaceShadowMaxDistance:2e3,screenSpaceShadowThickness:4,blurPasses:2,blurRadius:3,blurDepthThreshold:.02,upsampleDepthThreshold:.02,maxLights:128,maxShadowedLights:4,pcfTaps:4,selectionRefreshRate:2,debugMode:0}}a(Qe,"getDefaultVolumetricLightingConfiguration");function si(t){return t.lightSteps>0?t.lightSteps:Math.max(4,Math.min(64,Math.round(t.steps*.3)))}a(si,"getVolumetricLightSteps");function b(t,e,i,o){let r=typeof t=="number"&&isFinite(t)?t:e;return Math.min(o,Math.max(i,r))}a(b,"normalizeNumber");function ti(t,e){return!Array.isArray(t)||t.length<3?e.slice():[b(t[0],e[0],0,100),b(t[1],e[1],0,100),b(t[2],e[2],0,100)]}a(ti,"normalizeColor");function Co(t){let e=oi();return!t||typeof t!="object"?e:{enabled:t.enabled??e.enabled,volumeIntensity:b(t.volumeIntensity,e.volumeIntensity,0,1e3),anisotropy:b(t.anisotropy,e.anisotropy,-.95,.95),useCustomColor:t.useCustomColor??e.useCustomColor,color:ti(t.color,e.color),castVolumetricShadows:t.castVolumetricShadows??e.castVolumetricShadows,shadowDarkness:b(t.shadowDarkness,e.shadowDarkness,0,1),rangeMultiplier:b(t.rangeMultiplier,e.rangeMultiplier,0,100),priority:b(t.priority,e.priority,-1e3,1e3)}}a(Co,"normalizeVolumetricLightConfiguration");function Se(t){let e=Qe();return!t||typeof t!="object"?e:{steps:Math.round(b(t.steps,e.steps,4,256)),lightSteps:Math.round(b(t.lightSteps,e.lightSteps,0,128)),resolutionScale:b(t.resolutionScale,e.resolutionScale,.1,1),stepDistribution:Math.round(b(t.stepDistribution,e.stepDistribution,0,1)),ditherMode:Math.round(b(t.ditherMode,e.ditherMode,0,2)),ditherStrength:b(t.ditherStrength,e.ditherStrength,0,1),temporalJitter:t.temporalJitter??e.temporalJitter,fogMode:Math.round(b(t.fogMode,e.fogMode,0,2)),fogDensity:b(t.fogDensity,e.fogDensity,0,100),fogStart:b(t.fogStart,e.fogStart,0,1e6),fogEnd:Math.max(b(t.fogEnd,e.fogEnd,0,1e7),b(t.fogStart,e.fogStart,0,1e6)+.001),fogColor:ti(t.fogColor,e.fogColor),albedo:b(t.albedo,e.albedo,0,1),maxDistance:b(t.maxDistance,e.maxDistance,1,1e6),heightFogEnabled:t.heightFogEnabled??e.heightFogEnabled,heightFogBaseHeight:b(t.heightFogBaseHeight,e.heightFogBaseHeight,-1e6,1e6),heightFogFalloff:b(t.heightFogFalloff,e.heightFogFalloff,0,10),intensity:b(t.intensity,e.intensity,0,100),lightExtinctionEnabled:t.lightExtinctionEnabled??e.lightExtinctionEnabled,lightExtinctionClamp:b(t.lightExtinctionClamp,e.lightExtinctionClamp,0,1e6),extinctionAmount:b(t.extinctionAmount,e.extinctionAmount,0,1),ambientColor:ti(t.ambientColor,e.ambientColor),ambientIntensity:b(t.ambientIntensity,e.ambientIntensity,0,100),screenSpaceShadows:t.screenSpaceShadows??e.screenSpaceShadows,screenSpaceShadowSteps:Math.round(b(t.screenSpaceShadowSteps,e.screenSpaceShadowSteps,1,32)),screenSpaceShadowBias:b(t.screenSpaceShadowBias,e.screenSpaceShadowBias,0,1),screenSpaceShadowMaxDistance:b(t.screenSpaceShadowMaxDistance,e.screenSpaceShadowMaxDistance,1,1e7),screenSpaceShadowThickness:b(t.screenSpaceShadowThickness,e.screenSpaceShadowThickness,.01,1e3),blurPasses:Math.round(b(t.blurPasses,e.blurPasses,0,2)),blurRadius:Math.round(b(t.blurRadius,e.blurRadius,1,6)),blurDepthThreshold:b(t.blurDepthThreshold,e.blurDepthThreshold,1e-4,1),upsampleDepthThreshold:b(t.upsampleDepthThreshold,e.upsampleDepthThreshold,1e-4,1),maxLights:Math.round(b(t.maxLights,e.maxLights,0,$)),maxShadowedLights:Math.round(b(t.maxShadowedLights,e.maxShadowedLights,0,E)),pcfTaps:b(t.pcfTaps,e.pcfTaps,1,4)>=4?4:1,selectionRefreshRate:Math.round(b(t.selectionRefreshRate,e.selectionRefreshRate,1,60)),debugMode:Math.round(b(t.debugMode,e.debugMode,0,3))}}a(Se,"normalizeVolumetricLightingConfiguration");var ii=new WeakSet;function Lo(t){t.metadata??={};let e=t.metadata[ae];if(!e||typeof e!="object")return t.metadata[ae]=Co(null),ii.add(t.metadata[ae]),t.metadata[ae];if(ii.has(e))return e;let i=oi();return Object.keys(i).forEach(o=>{e[o]===void 0&&(e[o]=i[o])}),ii.add(e),e}a(Lo,"ensureVolumetricLightConfiguration");function li(t){let e=t.metadata?.[ae];return e&&typeof e=="object"?Lo(t):null}a(li,"getVolumetricLightConfiguration");function Hn(t){return t.metadata?.[ae]?.enabled===!0}a(Hn,"isVolumetricLightEnabled");var Je=require("babylonjs"),wo=require("babylonjs"),pi=require("babylonjs"),K=require("babylonjs"),mi=(o=>(o[o.Texture2D=0]="Texture2D",o[o.Sampler2DShadow=1]="Sampler2DShadow",o[o.Cube=2]="Cube",o))(mi||{}),Oo=(o=>(o[o.Standard=0]="Standard",o[o.Esm=1]="Esm",o[o.CloseEsm=2]="CloseEsm",o))(Oo||{}),hi=(o=>(o[o.Analytic=0]="Analytic",o[o.AnalyticHeight=1]="AnalyticHeight",o[o.Numeric=2]="Numeric",o))(hi||{}),Do=10,kn=4,Un=22,Wn=32,Xn=.15;function Me(t,e){let i=t.getCaps(),o=i.maxFragmentUniformVectors||224,r=t.isWebGPU?Math.floor(o/4):o,n=Math.max(224,r)-Wn,l=Math.max(8,i.maxTexturesImageUnits||16)-1,p=l>=2,s=p?Un:0,c=Math.max(0,Math.min(E,e.maxShadowedLights,l-(p?1:0),Math.floor((n-s)/Do))),m=Math.max(0,Math.min($,e.maxLights,Math.floor((n-s-c*Do)/kn)));return{maxShadowSlots:c,maxArrayLights:m,maxDirectionalLights:Math.min(ri,m),allowCsm:p}}a(Me,"computeVolumetricBudget");function Eo(t){let e=[];return t.lights.forEach(i=>{pe(i)?i.lights.forEach(o=>{e.push({light:o,isClustered:!0})}):e.push({light:i,isClustered:!1})}),e}a(Eo,"getAllVolumetricCandidateLights");function To(t,e){let i=t.getShadowGenerator(e.activeCamera)??t.getShadowGenerator();if(!i||!Lt(i))return null;let o=i.getShadowMapForRendering();if(!o?.isReady())return null;let r=i.getShadowMap()?.getSize().width??1024,n=o.textureType===pi.Constants.TEXTURETYPE_UNSIGNED_BYTE,l=!te(t),p=t.needCube?.()===!0;switch(i.filter){case K.ShadowGenerator.FILTER_PCF:case K.ShadowGenerator.FILTER_PCSS:return{generator:i,kind:p?2:1,mode:0,packed:n,mapSize:r,local:l};case K.ShadowGenerator.FILTER_EXPONENTIALSHADOWMAP:case K.ShadowGenerator.FILTER_BLUREXPONENTIALSHADOWMAP:return{generator:i,kind:p?2:0,mode:1,packed:n,mapSize:r,local:l};case K.ShadowGenerator.FILTER_CLOSEEXPONENTIALSHADOWMAP:case K.ShadowGenerator.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP:return{generator:i,kind:p?2:0,mode:2,packed:n,mapSize:r,local:l};default:return{generator:i,kind:p?2:0,mode:0,packed:n,mapSize:r,local:l}}}a(To,"resolveVolumetricShadowSlot");function et(t,e){let i=t;return i.computeTransformedInformation?.()&&i.transformedPosition?e.copyFrom(i.transformedPosition):i.position?e.copyFrom(i.position):e.copyFromFloats(0,0,0),e}a(et,"getVolumetricLightWorldPosition");function Re(t,e){let i=t;return i.computeTransformedInformation?.()&&i.transformedDirection?e.copyFrom(i.transformedDirection):i.direction?e.copyFrom(i.direction):e.copyFromFloats(0,0,1),e.normalize()}a(Re,"getVolumetricLightWorldDirection");function tt(t,e,i){let o=t.range>0&&t.range<Number.MAX_VALUE?t.range:i.maxDistance;return Math.max(.001,Math.min(o*e.rangeMultiplier,34e37))}a(tt,"getVolumetricLightRange");var ci=new Je.Vector3,_o=new Je.Vector3;function $n(t,e,i){if(et(t,i),!re(t))return e;let o=Math.cos(t.angle*.5);if(o<=.5)return e;let r=e/(2*o);return Re(t,_o),i.addInPlace(_o.scaleInPlace(r)),r}a($n,"computeVolumetricLightBounds");function Kn(t,e,i){for(let o=0;o<i.length;++o)if(i[o].dotCoordinate(t)<=-e)return!1;return!0}a(Kn,"isSphereInFrustum");function Po(t){return(t.local?64:0)+t.kind*16+t.mode*4+(t.packed?1:0)}a(Po,"getShadowSlotSignature");function di(t,e,i,o,r){let n={candidateCount:0,culledCount:0,shadowedCount:0,unshadowedCount:0,droppedCount:0,perLight:new Map},l=wo.Frustum.GetPlanes(t.getTransformMatrix()),p=e.globalPosition,s=[];Eo(t).forEach(({light:v,isClustered:C})=>{let R=li(v);if(!R?.enabled)return;if(n.candidateCount++,Ye(v)||!v.isEnabled()||v.intensity<=0||R.volumeIntensity<=0){n.perLight.set(v.uniqueId,{state:"disabled",slot:-1,reason:Ye(v)?"Hemispheric lights have no position nor direction and can't produce light shafts.":"The light is disabled or its intensity is zero."});return}let W=te(v),ce=R.priority*1e3;if(W)ce+=1e6;else{let Ke=Math.min(tt(v,R,i),i.maxDistance),xt=$n(v,Ke,ci);if(!Kn(ci,xt,l)){n.culledCount++,n.perLight.set(v.uniqueId,{state:"culled",slot:-1,reason:"The light is outside of the frustum of the camera and doesn't reach it."});return}let Sn=Math.max(1,Je.Vector3.Distance(ci,p)-xt);ce+=R.volumeIntensity*v.intensity*Math.min(4,xt/Sn)}s.push({light:v,config:R,isClustered:C,typeId:v.getTypeID(),score:ce})}),s.sort((v,C)=>C.score-v.score);let c=new Map;r?.shadowed.forEach((v,C)=>{c.set(v.candidate.light.uniqueId,C)});let m=[],h=[],d=new Map,f=null;s.forEach(v=>{let{light:C,config:R}=v;if(!R.castVolumetricShadows){d.set(C.uniqueId,"occlusion is disabled on this light."),h.push(v);return}if(v.isClustered){d.set(C.uniqueId,"clustered lighting doesn't support shadow maps."),h.push(v);return}if(!C.shadowEnabled||!t.shadowsEnabled){d.set(C.uniqueId,"shadows are disabled on this light or on the scene."),h.push(v);return}let W=C.getShadowGenerator(t.activeCamera)??C.getShadowGenerator();if(!W){d.set(C.uniqueId,"the light has no shadow generator."),h.push(v);return}if(Dt(W)&&o.allowCsm){let Ke=W.getShadowMapForRendering();if(!f&&Ke?.isReady()){f={candidate:v,generator:W,cascades:W.numCascades,kind:W.filter===K.ShadowGenerator.FILTER_PCF||W.filter===K.ShadowGenerator.FILTER_PCSS?1:0,packed:Ke.textureType===pi.Constants.TEXTURETYPE_UNSIGNED_BYTE};return}d.set(C.uniqueId,f?"another light already uses the single cascaded shadow map slot.":"its cascaded shadow map is not ready yet."),h.push(v);return}let ce=To(C,t);if(!ce){d.set(C.uniqueId,"the shadow map of the light is not ready yet."),h.push(v);return}m.push({candidate:v,shadow:ce})});function S(v){let C=v.candidate.score;return c.get(v.candidate.light.uniqueId)===void 0?C:C+Math.abs(C)*Xn}a(S,"getHysteresisScore");function u(v){return c.get(v.candidate.light.uniqueId)??Number.MAX_SAFE_INTEGER}a(u,"getPreviousSlot"),m.sort((v,C)=>{let R=S(C)-S(v);return R!==0?R:u(v)-u(C)});let y=m.slice(0,o.maxShadowSlots);y.sort((v,C)=>Po(v.shadow)-Po(C.shadow)||u(v)-u(C)),m.slice(o.maxShadowSlots).forEach(v=>{d.set(v.candidate.light.uniqueId,"the shadowed lights budget is full."),h.push(v.candidate)}),h.sort((v,C)=>C.score-v.score);let L=[],_=[],x=[];h.forEach(v=>{te(v.light)?L.length<o.maxDirectionalLights?L.push(v):x.push({candidate:v,reason:`Not rendered: at most ${o.maxDirectionalLights} directional light(s) without a shadow map can take part in the effect.`}):_.push(v)});let M=Math.max(0,o.maxArrayLights-L.length);_.slice(M).forEach(v=>{x.push({candidate:v,reason:'Not rendered: the lights budget is full. Raise "Max Lights" or lower the priority of the other lights.'})});let N=L.concat(_.slice(0,M));if(y.forEach((v,C)=>{n.shadowedCount++,n.perLight.set(v.candidate.light.uniqueId,{state:"shadowed",slot:C,reason:`Casting volumetric shadows using slot ${C+1} of ${o.maxShadowSlots}.`})}),f){let v=f;n.shadowedCount++,n.perLight.set(v.candidate.light.uniqueId,{state:"shadowed",slot:-1,reason:`Casting volumetric shadows using its ${v.cascades} shadow cascades.`})}return N.forEach(v=>{n.unshadowedCount++;let C=v.config.castVolumetricShadows?"Occluded using the depth buffer":"Not occluded by the geometry",R=d.get(v.light.uniqueId)??"the light has no shadow map.";n.perLight.set(v.light.uniqueId,{state:"unshadowed",slot:-1,reason:`${C}: ${R}`})}),x.forEach(({candidate:v,reason:C})=>{n.droppedCount++,n.perLight.set(v.light.uniqueId,{state:"dropped",slot:-1,reason:C})}),{shadowed:y,unshadowed:N,directionalCount:L.length,csm:f,stats:n}}a(di,"selectVolumetricLights");function jn(t,e,i){let o=t.shadowed.map(n=>`${n.shadow.kind}.${n.shadow.mode}.${n.shadow.packed?1:0}.${n.shadow.local?1:0}`).join("|"),r=t.csm?`${t.csm.kind}.${t.csm.cascades}.${t.csm.packed?1:0}`:"-";return[e.steps,i.lightSteps,e.stepDistribution,e.ditherMode,e.temporalJitter?1:0,e.heightFogEnabled?1:0,e.lightExtinctionEnabled?1:0,e.pcfTaps,e.blurRadius,e.debugMode,e.screenSpaceShadows?e.screenSpaceShadowSteps:0,i.fogMode,i.transmittance,i.depthMode,i.ldrEncode?1:0,i.reverseDepth?1:0,i.ndcHalfZ?1:0,i.linearDepthPacked?1:0,i.arrayLightCapacity,t.directionalCount,o,r].join(",")}a(jn,"computeVolumetricShapeKey");function Zn(t){return Ct(t)||re(t)||te(t)}a(Zn,"isVolumetricLightSupported");var fi=require("babylonjs"),Yn=0,ui=(o=>(o[o.DepthRenderer=0]="DepthRenderer",o[o.GeometryBuffer=1]="GeometryBuffer",o[o.PrePass=2]="PrePass",o))(ui||{}),Ao="volumetricLighting";function gi(){return{name:Ao,enabled:!1,texturesRequired:[fi.Constants.PREPASS_DEPTH_TEXTURE_TYPE]}}a(gi,"createVolumetricLightingPrePassConfiguration");function ye(t){return t.prePassRenderer??null}a(ye,"getVolumetricPrePassRenderer");function Ve(t){return t.geometryBufferRenderer??null}a(Ve,"getVolumetricGeometryBufferRenderer");function Io(t){let e=t.getCaps();return e.textureFloat&&e.textureFloatLinearFiltering||e.textureHalfFloat&&e.textureHalfFloatLinearFiltering}a(Io,"supportsVolumetricFloatDepthTexture");function it(t){return Io(t.getEngine())?ye(t)?.isSupported?2:Ve(t)?.isSupported?1:0:0}a(it,"resolveVolumetricDepthSource");function vi(t){let e=t.getIndex(fi.Constants.PREPASS_DEPTH_TEXTURE_TYPE);return e===void 0||e<0?null:t.getRenderTarget()?.textures?.[e]??null}a(vi,"getVolumetricPrePassDepthTexture");function Si(t){if(!t.enableDepth)return null;let e=t.getTextureIndex(Yn);return e<0?null:t.getGBuffer()?.textures?.[e]??null}a(Si,"getVolumetricGeometryBufferDepthTexture");var ot=`
2
2
  fn volUnpack(color: vec4f) -> f32 {
3
3
  let bitShift = vec4f(1.0 / (255.0 * 255.0 * 255.0), 1.0 / (255.0 * 255.0), 1.0 / 255.0, 1.0);
4
4
  return dot(color, bitShift);
@@ -1125,7 +1125,7 @@ fn main(input: FragmentInputs) -> FragmentOutputs {
1125
1125
  fragmentOutputs.color = vec4f(result, 1.0);
1126
1126
  #endif
1127
1127
  }
1128
- `}a(ta,"buildVolumetricLightingComposeShaderWGSL");function Ro(){return{linearDepth:Qn(),scattering:Jn(E),blur:ea(),compose:ta()}}a(Ro,"getVolumetricLightingShadersWGSL");var Z=require("babylonjs"),No=require("babylonjs"),nt="volumetricLightingLinearDepth",at="volumetricLightingScattering",st="volumetricLightingBlur",lt="volumetricLightingCompose",rt=`
1128
+ `}a(ta,"buildVolumetricLightingComposeShaderWGSL");function Ro(){return{linearDepth:Qn(),scattering:Jn(E),blur:ea(),compose:ta()}}a(Ro,"getVolumetricLightingShadersWGSL");var j=require("babylonjs"),No=require("babylonjs"),nt="volumetricLightingLinearDepth",at="volumetricLightingScattering",st="volumetricLightingBlur",lt="volumetricLightingCompose",rt=`
1129
1129
  float volUnpack(vec4 color) {
1130
1130
  const vec4 bitShift = vec4(1.0 / (255.0 * 255.0 * 255.0), 1.0 / (255.0 * 255.0), 1.0 / 255.0, 1.0);
1131
1131
  return dot(color, bitShift);
@@ -2301,7 +2301,7 @@ void main(void) {
2301
2301
 
2302
2302
  gl_FragColor = vec4(result, 1.0);
2303
2303
  }
2304
- `}a(aa,"buildVolumetricLightingComposeShader");var Fo={};function Go(t){if(!Fo[t]){if(Fo[t]=!0,t===No.ShaderLanguage.WGSL){let e=Ro();Z.ShaderStore.ShadersStoreWGSL[`${nt}PixelShader`]=e.linearDepth,Z.ShaderStore.ShadersStoreWGSL[`${at}PixelShader`]=e.scattering,Z.ShaderStore.ShadersStoreWGSL[`${st}PixelShader`]=e.blur,Z.ShaderStore.ShadersStoreWGSL[`${lt}PixelShader`]=e.compose;return}Z.ShaderStore.ShadersStore[`${nt}PixelShader`]=oa(),Z.ShaderStore.ShadersStore[`${at}PixelShader`]=ra(E),Z.ShaderStore.ShadersStore[`${st}PixelShader`]=na(),Z.ShaderStore.ShadersStore[`${lt}PixelShader`]=aa()}}a(Go,"registerVolumetricLightingShaders");var Ho=require("babylonjs"),ko=require("babylonjs"),Y=require("babylonjs"),be=require("babylonjs"),Fe=require("babylonjs"),Uo=require("babylonjs"),xi=require("babylonjs"),Ne=require("babylonjs"),Wo=require("babylonjs"),sa=new be.Vector3(0,0,1),la=new be.Vector3(0,0,-1),Bo=["resolutionScale","blurPasses"],ca=32,pa=["volInverseViewProjection","volViewProjection","volCameraPosition","volCameraForward","volCameraMinMaxZ","volDepthRatio","volFrameIndex","volFogInfos","volFogColor","volLinearFogEps","volMedium","volScreenShadowParams","volAmbient","volParams","volLightData","volLightDiffuse","volLightDirection","volLightFalloff","volShadowLightData","volShadowLightDiffuse","volShadowLightDirection","volShadowLightFalloff","volShadowInfo","volShadowMatrix","volCsmLightData","volCsmLightDiffuse","volCsmLightDirection","volCsmLightFalloff","volCsmInfo","volCsmMatrices"],zo=["volCsmSampler"];for(let t=0;t<E;++t)zo.push(`volShadowSampler${t}`);var q=class t extends Wo.PostProcessRenderPipeline{static{a(this,"VolumetricLightingRenderingPipeline")}static SceneColorEffectName="VolumetricLightingSceneColorEffect";static ScatteringEffectName="VolumetricLightingScatteringEffect";static BlurEffectName="VolumetricLightingBlurEffect";static ComposeEffectName="VolumetricLightingComposeEffect";static GetDefaultFogEnd(e,i){return 1/t.GetDefaultFogDensity(e,i)}static GetDefaultFogDensity(e,i){let o=0;if(e.meshes.length){let r=e.getWorldExtends(),n=r.max.subtract(r.min).length();isFinite(n)&&(o=n)}return o<.001&&(o=Math.max(i.globalPosition.length(),i.maxZ*.001,1)),Math.min(1,Math.max(1e-5,1/Math.max(.001,o)))}static IsSupported(e){return e.isWebGPU?!0:(e.webGLVersion??0)>=2}static GetShaderLanguage(e){return e.isWebGPU?xi.ShaderLanguage.WGSL:xi.ShaderLanguage.GLSL}_scene;_camera;_configuration;_configurationProxy;_textureType;_shaderLanguage;_ldrEncode;_linearDepthPacked;_msaaSamples=1;_msaaSamplesAssigned=!1;_depthSource=0;_depthRenderer=null;_ownsDepthRenderer=!1;_depthMode=0;_prePassConfiguration=gi();_linearDepthPostProcess=null;_scatteringPostProcess=null;_blurPostProcesses=[];_composePostProcess=null;_selection=null;_budget;_linearDepthDefines="";_scatteringDefines="";_blurDefines="";_composeDefines="";_frameCount=0;_lightsDirty=!0;_disposed=!1;_beforeCameraRenderObserver=null;_lightAddedObserver=null;_lightRemovedObserver=null;_inverseViewProjection=be.Matrix.Identity();_temporaryVector=new be.Vector3;_temporaryColor=new ko.Color3;_lightData=new Float32Array(K*4);_lightDiffuse=new Float32Array(K*4);_lightDirection=new Float32Array(K*4);_lightFalloff=new Float32Array(K*4);_shadowLightData=new Float32Array(E*4);_shadowLightDiffuse=new Float32Array(E*4);_shadowLightDirection=new Float32Array(E*4);_shadowLightFalloff=new Float32Array(E*4);_shadowInfo=new Float32Array(E*4);_shadowMatrices=new Float32Array(E*16);_csmLightData=new Float32Array(4);_csmLightDiffuse=new Float32Array(4);_csmLightDirection=new Float32Array(4);_csmLightFalloff=new Float32Array(4);_csmMatrices=new Float32Array(64);constructor(e,i,o,r){super(i.getEngine(),e),this._shaderLanguage=t.GetShaderLanguage(i.getEngine()),Go(this._shaderLanguage),this._scene=i,this._camera=o,this._configuration=Se({...Qe(),fogDensity:r?.fogDensity??t.GetDefaultFogDensity(i,o),fogEnd:r?.fogEnd??t.GetDefaultFogEnd(i,o),screenSpaceShadowMaxDistance:r?.screenSpaceShadowMaxDistance??t.GetDefaultFogEnd(i,o),...r}),this._configurationProxy=new Proxy(this._configuration,{set:a((s,c,m)=>{let h=c;return s[h]===m||(s[h]=m,this._onConfigurationChanged(h)),!0},"set")});let n=i.getEngine(),l=n.getCaps(),p=l.textureHalfFloatRender&&l.textureHalfFloatLinearFiltering;this._textureType=p?Y.Constants.TEXTURETYPE_HALF_FLOAT:Y.Constants.TEXTURETYPE_UNSIGNED_BYTE,this._ldrEncode=!p,this._linearDepthPacked=!l.textureFloatRender,this._budget=Me(n,this._configuration),this._depthSource=it(i),this._setupDepthSource(),this._buildRenderEffects(),i.postProcessRenderPipelineManager.addPipeline(this),i.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this.name,o),this._beforeCameraRenderObserver=i.onBeforeCameraRenderObservable.add(s=>{s===this._camera&&(this._updateDepthSource(),this._updateSelection())}),this._lightAddedObserver=i.onNewLightAddedObservable.add(()=>this.markLightsDirty()),this._lightRemovedObserver=i.onLightRemovedObservable.add(()=>this.markLightsDirty())}get isDisposed(){return this._disposed}get scene(){return this._scene}get camera(){return this._camera}get configuration(){return this._configurationProxy}get depthSource(){return this._depthSource}get msaaSamples(){return this._msaaSamples}set msaaSamples(e){this._msaaSamples=e,this._msaaSamplesAssigned=!0,this._applyMsaaSamples()}getStats(){return this._selection?.stats??null}getBudget(){return this._budget}getClassName(){return"VolumetricLightingRenderingPipeline"}markLightsDirty(){this._lightsDirty=!0}applyConfiguration(e){let i=Se({...this._configuration,...e}),o=Bo.some(r=>i[r]!==this._configuration[r]);Object.assign(this._configuration,i),this._budget=Me(this._scene.getEngine(),this._configuration),this._lightsDirty=!0,o&&this._rebuildRenderEffects()}serializeConfiguration(){return{...this._configuration,fogColor:this._configuration.fogColor.slice(),ambientColor:this._configuration.ambientColor.slice()}}dispose(){if(this._disposed)return;this._disposed=!0,this._scene.onBeforeCameraRenderObservable.remove(this._beforeCameraRenderObserver),this._scene.onNewLightAddedObservable.remove(this._lightAddedObserver),this._scene.onLightRemovedObservable.remove(this._lightRemovedObserver),this._beforeCameraRenderObserver=null,this._lightAddedObserver=null,this._lightRemovedObserver=null;let e=this._cameras.slice();this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this.name,e),this._disposePostProcesses(e),this._releaseDepthSource(),this._selection=null,this._scene.postProcessRenderPipelineManager.removePipeline(this.name),super.dispose()}_onConfigurationChanged(e){(e==="maxLights"||e==="maxShadowedLights")&&(this._budget=Me(this._scene.getEngine(),this._configuration)),this._lightsDirty=!0,Bo.includes(e)&&this._rebuildRenderEffects()}_setupDepthSource(){switch(this._depthSource){case 2:this._depthMode=1;break;case 1:this._ensureGeometryBufferDepth(),this._depthMode=1;break;default:this._setupDepthRenderer();break}this._applyPrePassConfiguration(),this._applyMsaaSamples()}_releaseDepthSource(){this._ownsDepthRenderer&&this._scene.disableDepthRenderer(this._camera),this._depthRenderer=null,this._ownsDepthRenderer=!1,this._linearDepthPostProcess&&(this._linearDepthPostProcess._prePassEffectConfiguration=void 0)}_updateDepthSource(){if(this._disposed)return;let e=it(this._scene);if(e===this._depthSource){e===1&&this._ensureGeometryBufferDepth();return}this._releaseDepthSource(),this._depthSource=e,this._setupDepthSource(),ye(this._scene)?.markAsDirty(),this._lightsDirty=!0}_ensureGeometryBufferDepth(){let e=Ve(this._scene);e&&!e.enableDepth&&(e.enableDepth=!0)}_applyPrePassConfiguration(){this._linearDepthPostProcess&&this._depthSource===2&&(this._linearDepthPostProcess._prePassEffectConfiguration=this._prePassConfiguration)}_applyMsaaSamples(){if(this._msaaSamplesAssigned){if(this._depthSource===2){let e=ye(this._scene);if(e){e.samples=this._msaaSamples;return}}!this._enableMSAAOnFirstPostProcess(this._msaaSamples)&&this._msaaSamples>1&&console.warn("Volumetric lighting: MSAA is not supported by the engine, the requested samples are ignored.")}}_setupDepthRenderer(){let e=this._scene._depthRenderer?.[this._camera.uniqueId];this._ownsDepthRenderer=!e,this._depthRenderer=e??this._scene.enableDepthRenderer(this._camera,!1,!1,Y.Constants.TEXTURE_NEAREST_SAMPLINGMODE,!1),this._depthRenderer.isPacked?this._depthMode=2:this._depthRenderer.clearColor.r===0?this._depthMode=1:this._depthMode=0}_bindDepthUniforms(e){let i=this._camera,o=this._scene.getEngine();if(e.setFloat2("volCameraMinMaxZ",i.minZ,i.maxZ),this._depthMode===1){e.setFloat2("volDepthUnpack",1,0);return}let r=i.mode===Ho.Camera.ORTHOGRAPHIC_CAMERA,n=r?!o.useReverseDepthBuffer&&o.isNDCHalfZRange?0:1:o.useReverseDepthBuffer&&o.isNDCHalfZRange?i.minZ:o.isNDCHalfZRange?0:i.minZ,l=r?o.useReverseDepthBuffer&&o.isNDCHalfZRange?0:1:o.useReverseDepthBuffer&&o.isNDCHalfZRange?0:i.maxZ,p=this._scene.getProjectionMatrix().m,s=p[10],c=p[14];if(!s){e.setFloat2("volDepthUnpack",i.maxZ,0);return}let m=o.useReverseDepthBuffer?-1:1;e.setFloat2("volDepthUnpack",m*(n+l)/s,(-m*n-c)/s)}_getEnvironment(){let e=this._configuration,i=0;return e.heightFogEnabled&&(i=e.fogMode===0?1:2),{depthMode:this._depthMode,ldrEncode:this._ldrEncode,reverseDepth:this._scene.getEngine().useReverseDepthBuffer,ndcHalfZ:this._scene.getEngine().isNDCHalfZRange,fogMode:e.fogMode,transmittance:i,linearDepthPacked:this._linearDepthPacked,arrayLightCapacity:this._budget.maxArrayLights,lightSteps:si(e)}}_buildLinearDepthReadDefines(e){return e.linearDepthPacked?`#define VOL_LINEAR_DEPTH_PACKED
2304
+ `}a(aa,"buildVolumetricLightingComposeShader");var Fo={};function Go(t){if(!Fo[t]){if(Fo[t]=!0,t===No.ShaderLanguage.WGSL){let e=Ro();j.ShaderStore.ShadersStoreWGSL[`${nt}PixelShader`]=e.linearDepth,j.ShaderStore.ShadersStoreWGSL[`${at}PixelShader`]=e.scattering,j.ShaderStore.ShadersStoreWGSL[`${st}PixelShader`]=e.blur,j.ShaderStore.ShadersStoreWGSL[`${lt}PixelShader`]=e.compose;return}j.ShaderStore.ShadersStore[`${nt}PixelShader`]=oa(),j.ShaderStore.ShadersStore[`${at}PixelShader`]=ra(E),j.ShaderStore.ShadersStore[`${st}PixelShader`]=na(),j.ShaderStore.ShadersStore[`${lt}PixelShader`]=aa()}}a(Go,"registerVolumetricLightingShaders");var Ho=require("babylonjs"),ko=require("babylonjs"),Z=require("babylonjs"),be=require("babylonjs"),Fe=require("babylonjs"),Uo=require("babylonjs"),xi=require("babylonjs"),Ne=require("babylonjs"),Wo=require("babylonjs"),sa=new be.Vector3(0,0,1),la=new be.Vector3(0,0,-1),Bo=["resolutionScale","blurPasses"],ca=32,pa=["volInverseViewProjection","volViewProjection","volCameraPosition","volCameraForward","volCameraMinMaxZ","volDepthRatio","volFrameIndex","volFogInfos","volFogColor","volLinearFogEps","volMedium","volScreenShadowParams","volAmbient","volParams","volLightData","volLightDiffuse","volLightDirection","volLightFalloff","volShadowLightData","volShadowLightDiffuse","volShadowLightDirection","volShadowLightFalloff","volShadowInfo","volShadowMatrix","volCsmLightData","volCsmLightDiffuse","volCsmLightDirection","volCsmLightFalloff","volCsmInfo","volCsmMatrices"],zo=["volCsmSampler"];for(let t=0;t<E;++t)zo.push(`volShadowSampler${t}`);var Y=class t extends Wo.PostProcessRenderPipeline{static{a(this,"VolumetricLightingRenderingPipeline")}static SceneColorEffectName="VolumetricLightingSceneColorEffect";static ScatteringEffectName="VolumetricLightingScatteringEffect";static BlurEffectName="VolumetricLightingBlurEffect";static ComposeEffectName="VolumetricLightingComposeEffect";static GetDefaultFogEnd(e,i){return 1/t.GetDefaultFogDensity(e,i)}static GetDefaultFogDensity(e,i){let o=0;if(e.meshes.length){let r=e.getWorldExtends(),n=r.max.subtract(r.min).length();isFinite(n)&&(o=n)}return o<.001&&(o=Math.max(i.globalPosition.length(),i.maxZ*.001,1)),Math.min(1,Math.max(1e-5,1/Math.max(.001,o)))}static IsSupported(e){return e.isWebGPU?!0:(e.webGLVersion??0)>=2}static GetShaderLanguage(e){return e.isWebGPU?xi.ShaderLanguage.WGSL:xi.ShaderLanguage.GLSL}_scene;_camera;_configuration;_configurationProxy;_textureType;_shaderLanguage;_ldrEncode;_linearDepthPacked;_msaaSamples=1;_msaaSamplesAssigned=!1;_depthSource=0;_depthRenderer=null;_ownsDepthRenderer=!1;_depthMode=0;_prePassConfiguration=gi();_linearDepthPostProcess=null;_scatteringPostProcess=null;_blurPostProcesses=[];_composePostProcess=null;_selection=null;_budget;_linearDepthDefines="";_scatteringDefines="";_blurDefines="";_composeDefines="";_frameCount=0;_lightsDirty=!0;_disposed=!1;_beforeCameraRenderObserver=null;_lightAddedObserver=null;_lightRemovedObserver=null;_inverseViewProjection=be.Matrix.Identity();_temporaryVector=new be.Vector3;_temporaryColor=new ko.Color3;_lightData=new Float32Array($*4);_lightDiffuse=new Float32Array($*4);_lightDirection=new Float32Array($*4);_lightFalloff=new Float32Array($*4);_shadowLightData=new Float32Array(E*4);_shadowLightDiffuse=new Float32Array(E*4);_shadowLightDirection=new Float32Array(E*4);_shadowLightFalloff=new Float32Array(E*4);_shadowInfo=new Float32Array(E*4);_shadowMatrices=new Float32Array(E*16);_csmLightData=new Float32Array(4);_csmLightDiffuse=new Float32Array(4);_csmLightDirection=new Float32Array(4);_csmLightFalloff=new Float32Array(4);_csmMatrices=new Float32Array(64);constructor(e,i,o,r){super(i.getEngine(),e),this._shaderLanguage=t.GetShaderLanguage(i.getEngine()),Go(this._shaderLanguage),this._scene=i,this._camera=o,this._configuration=Se({...Qe(),fogDensity:r?.fogDensity??t.GetDefaultFogDensity(i,o),fogEnd:r?.fogEnd??t.GetDefaultFogEnd(i,o),screenSpaceShadowMaxDistance:r?.screenSpaceShadowMaxDistance??t.GetDefaultFogEnd(i,o),...r}),this._configurationProxy=new Proxy(this._configuration,{set:a((s,c,m)=>{let h=c;return s[h]===m||(s[h]=m,this._onConfigurationChanged(h)),!0},"set")});let n=i.getEngine(),l=n.getCaps(),p=l.textureHalfFloatRender&&l.textureHalfFloatLinearFiltering;this._textureType=p?Z.Constants.TEXTURETYPE_HALF_FLOAT:Z.Constants.TEXTURETYPE_UNSIGNED_BYTE,this._ldrEncode=!p,this._linearDepthPacked=!l.textureFloatRender,this._budget=Me(n,this._configuration),this._depthSource=it(i),this._setupDepthSource(),this._buildRenderEffects(),i.postProcessRenderPipelineManager.addPipeline(this),i.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this.name,o),this._beforeCameraRenderObserver=i.onBeforeCameraRenderObservable.add(s=>{s===this._camera&&(this._updateDepthSource(),this._updateSelection())}),this._lightAddedObserver=i.onNewLightAddedObservable.add(()=>this.markLightsDirty()),this._lightRemovedObserver=i.onLightRemovedObservable.add(()=>this.markLightsDirty())}get isDisposed(){return this._disposed}get scene(){return this._scene}get camera(){return this._camera}get configuration(){return this._configurationProxy}get depthSource(){return this._depthSource}get msaaSamples(){return this._msaaSamples}set msaaSamples(e){this._msaaSamples=e,this._msaaSamplesAssigned=!0,this._applyMsaaSamples()}getStats(){return this._selection?.stats??null}getBudget(){return this._budget}getClassName(){return"VolumetricLightingRenderingPipeline"}markLightsDirty(){this._lightsDirty=!0}applyConfiguration(e){let i=Se({...this._configuration,...e}),o=Bo.some(r=>i[r]!==this._configuration[r]);Object.assign(this._configuration,i),this._budget=Me(this._scene.getEngine(),this._configuration),this._lightsDirty=!0,o&&this._rebuildRenderEffects()}serializeConfiguration(){return{...this._configuration,fogColor:this._configuration.fogColor.slice(),ambientColor:this._configuration.ambientColor.slice()}}dispose(){if(this._disposed)return;this._disposed=!0,this._scene.onBeforeCameraRenderObservable.remove(this._beforeCameraRenderObserver),this._scene.onNewLightAddedObservable.remove(this._lightAddedObserver),this._scene.onLightRemovedObservable.remove(this._lightRemovedObserver),this._beforeCameraRenderObserver=null,this._lightAddedObserver=null,this._lightRemovedObserver=null;let e=this._cameras.slice();this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this.name,e),this._disposePostProcesses(e),this._releaseDepthSource(),this._selection=null,this._scene.postProcessRenderPipelineManager.removePipeline(this.name),super.dispose()}_onConfigurationChanged(e){(e==="maxLights"||e==="maxShadowedLights")&&(this._budget=Me(this._scene.getEngine(),this._configuration)),this._lightsDirty=!0,Bo.includes(e)&&this._rebuildRenderEffects()}_setupDepthSource(){switch(this._depthSource){case 2:this._depthMode=1;break;case 1:this._ensureGeometryBufferDepth(),this._depthMode=1;break;default:this._setupDepthRenderer();break}this._applyPrePassConfiguration(),this._applyMsaaSamples()}_releaseDepthSource(){this._ownsDepthRenderer&&this._scene.disableDepthRenderer(this._camera),this._depthRenderer=null,this._ownsDepthRenderer=!1,this._linearDepthPostProcess&&(this._linearDepthPostProcess._prePassEffectConfiguration=void 0)}_updateDepthSource(){if(this._disposed)return;let e=it(this._scene);if(e===this._depthSource){e===1&&this._ensureGeometryBufferDepth();return}this._releaseDepthSource(),this._depthSource=e,this._setupDepthSource(),ye(this._scene)?.markAsDirty(),this._lightsDirty=!0}_ensureGeometryBufferDepth(){let e=Ve(this._scene);e&&!e.enableDepth&&(e.enableDepth=!0)}_applyPrePassConfiguration(){this._linearDepthPostProcess&&this._depthSource===2&&(this._linearDepthPostProcess._prePassEffectConfiguration=this._prePassConfiguration)}_applyMsaaSamples(){if(this._msaaSamplesAssigned){if(this._depthSource===2){let e=ye(this._scene);if(e){e.samples=this._msaaSamples;return}}!this._enableMSAAOnFirstPostProcess(this._msaaSamples)&&this._msaaSamples>1&&console.warn("Volumetric lighting: MSAA is not supported by the engine, the requested samples are ignored.")}}_setupDepthRenderer(){let e=this._scene._depthRenderer?.[this._camera.uniqueId];this._ownsDepthRenderer=!e,this._depthRenderer=e??this._scene.enableDepthRenderer(this._camera,!1,!1,Z.Constants.TEXTURE_NEAREST_SAMPLINGMODE,!1),this._depthRenderer.isPacked?this._depthMode=2:this._depthRenderer.clearColor.r===0?this._depthMode=1:this._depthMode=0}_bindDepthUniforms(e){let i=this._camera,o=this._scene.getEngine();if(e.setFloat2("volCameraMinMaxZ",i.minZ,i.maxZ),this._depthMode===1){e.setFloat2("volDepthUnpack",1,0);return}let r=i.mode===Ho.Camera.ORTHOGRAPHIC_CAMERA,n=r?!o.useReverseDepthBuffer&&o.isNDCHalfZRange?0:1:o.useReverseDepthBuffer&&o.isNDCHalfZRange?i.minZ:o.isNDCHalfZRange?0:i.minZ,l=r?o.useReverseDepthBuffer&&o.isNDCHalfZRange?0:1:o.useReverseDepthBuffer&&o.isNDCHalfZRange?0:i.maxZ,p=this._scene.getProjectionMatrix().m,s=p[10],c=p[14];if(!s){e.setFloat2("volDepthUnpack",i.maxZ,0);return}let m=o.useReverseDepthBuffer?-1:1;e.setFloat2("volDepthUnpack",m*(n+l)/s,(-m*n-c)/s)}_getEnvironment(){let e=this._configuration,i=0;return e.heightFogEnabled&&(i=e.fogMode===0?1:2),{depthMode:this._depthMode,ldrEncode:this._ldrEncode,reverseDepth:this._scene.getEngine().useReverseDepthBuffer,ndcHalfZ:this._scene.getEngine().isNDCHalfZRange,fogMode:e.fogMode,transmittance:i,linearDepthPacked:this._linearDepthPacked,arrayLightCapacity:this._budget.maxArrayLights,lightSteps:si(e)}}_buildLinearDepthReadDefines(e){return e.linearDepthPacked?`#define VOL_LINEAR_DEPTH_PACKED
2305
2305
  `:""}_buildLinearDepthDefines(e){let i=this._buildLinearDepthReadDefines(e);return e.depthMode===2?i+=`#define VOL_DEPTH_PACKED
2306
2306
  `:e.depthMode===1&&(i+=`#define VOL_DEPTH_VIEWZ
2307
2307
  `),i}_buildScatteringDefines(e,i){let o=this._configuration,r=e?.shadowed??[],n=e?.directionalCount??0,l=e?.csm??null,p=r.filter(c=>!c.shadow.local).length,s=this._buildLinearDepthReadDefines(i);return s+=`#define VOL_STEPS ${o.steps}
@@ -2339,4 +2339,4 @@ void main(void) {
2339
2339
  `)),s}_buildBlurDefines(e){return`${this._buildLinearDepthReadDefines(e)}#define VOL_BLUR_RADIUS ${this._configuration.blurRadius}
2340
2340
  `}_buildComposeDefines(e){let i=this._buildLinearDepthReadDefines(e);return i+=`#define VOL_DEBUG ${this._configuration.debugMode}
2341
2341
  `,e.ldrEncode&&(i+=`#define VOL_LDR_ENCODE
2342
- `),i}_createPostProcess(e){let i=new Uo.PostProcess(e.name,e.shaderName,e.uniforms,e.samplers,e.ratio,null,e.samplingMode,this._scene.getEngine(),!1,e.defines,e.textureType,void 0,void 0,!1,e.textureFormat,this._shaderLanguage);return i.autoClear=!1,i.alphaMode=Y.Constants.ALPHA_DISABLE,i}_buildRenderEffects(){let e=this._scene.getEngine(),i=this._configuration,o=this._getEnvironment();this._linearDepthDefines=this._buildLinearDepthDefines(o),this._scatteringDefines=this._buildScatteringDefines(this._selection,o),this._blurDefines=this._buildBlurDefines(o),this._composeDefines=this._buildComposeDefines(o),this._linearDepthPostProcess=this._createPostProcess({name:"VolumetricLightingLinearDepth",shaderName:nt,uniforms:["volCameraMinMaxZ","volDepthUnpack"],samplers:["depthSampler"],ratio:1,samplingMode:Fe.Texture.BILINEAR_SAMPLINGMODE,textureType:this._textureType,defines:this._linearDepthDefines}),this._linearDepthPostProcess.onApplyObservable.add(r=>this._bindLinearDepth(r)),this._applyPrePassConfiguration(),this._scatteringPostProcess=this._createPostProcess({name:"VolumetricLightingScattering",shaderName:at,uniforms:pa,samplers:zo,ratio:1,samplingMode:Fe.Texture.NEAREST_SAMPLINGMODE,textureType:this._linearDepthPacked?Y.Constants.TEXTURETYPE_UNSIGNED_BYTE:Y.Constants.TEXTURETYPE_FLOAT,textureFormat:this._linearDepthPacked?Y.Constants.TEXTUREFORMAT_RGBA:Y.Constants.TEXTUREFORMAT_R,defines:this._scatteringDefines}),this._scatteringPostProcess.onApplyObservable.add(r=>this._bindScattering(r)),this._blurPostProcesses=[];for(let r=0;r<i.blurPasses;++r){let n=this._createPostProcess({name:`VolumetricLightingBlur${r}`,shaderName:st,uniforms:["volCameraMinMaxZ","volDepthRatio","volBlurDirection","volBlurParams"],samplers:["volLinearDepthSampler"],ratio:i.resolutionScale,samplingMode:Fe.Texture.BILINEAR_SAMPLINGMODE,textureType:this._textureType,defines:this._blurDefines});n.onApplyObservable.add(l=>this._bindBlur(l,r)),this._blurPostProcesses.push(n)}this._composePostProcess=this._createPostProcess({name:"VolumetricLightingCompose",shaderName:lt,uniforms:["volCameraMinMaxZ","volDepthRatio","volComposeParams"],samplers:["volSceneSampler","volLinearDepthSampler"],ratio:i.resolutionScale,samplingMode:Fe.Texture.BILINEAR_SAMPLINGMODE,textureType:this._textureType,defines:this._composeDefines}),this._composePostProcess.onApplyObservable.add(r=>this._bindCompose(r)),this.addEffect(new Ne.PostProcessRenderEffect(e,t.SceneColorEffectName,()=>this._linearDepthPostProcess,!0)),this.addEffect(new Ne.PostProcessRenderEffect(e,t.ScatteringEffectName,()=>this._scatteringPostProcess,!0)),this._blurPostProcesses.length&&this.addEffect(new Ne.PostProcessRenderEffect(e,t.BlurEffectName,()=>this._blurPostProcesses,!0)),this.addEffect(new Ne.PostProcessRenderEffect(e,t.ComposeEffectName,()=>this._composePostProcess,!0)),this._applyMsaaSamples()}_disposePostProcesses(e){[this._linearDepthPostProcess,this._scatteringPostProcess,...this._blurPostProcesses,this._composePostProcess].forEach(o=>{o&&(e.forEach(r=>o.dispose(r)),o.dispose())}),this._linearDepthPostProcess=null,this._scatteringPostProcess=null,this._blurPostProcesses=[],this._composePostProcess=null}_rebuildRenderEffects(){if(this._disposed)return;let e=this._scene.postProcessRenderPipelineManager,i=this._cameras.slice();try{e.detachCamerasFromRenderPipeline(this.name,i),this._disposePostProcesses(i),Object.keys(this._renderEffects).forEach(o=>{delete this._renderEffects[o]}),this._buildRenderEffects()}catch(o){console.error("Failed to rebuild the volumetric lighting rendering pipeline.",o)}finally{try{e.attachCamerasToRenderPipeline(this.name,i)}catch(o){console.error("Failed to re-attach the cameras to the volumetric lighting rendering pipeline.",o)}}this._lightsDirty=!0}_updateSelection(){if(this._disposed||!this._scatteringPostProcess||(++this._frameCount,!(this._lightsDirty||!this._selection||this._frameCount%this._configuration.selectionRefreshRate===0)))return;this._lightsDirty=!1;let i=this._getEnvironment(),o=di(this._scene,this._camera,this._configuration,this._budget,this._selection);this._selection=o;let r=this._buildScatteringDefines(o,i);r!==this._scatteringDefines&&(this._scatteringDefines=r,this._scatteringPostProcess.updateEffect(r));let n=this._buildLinearDepthDefines(i);n!==this._linearDepthDefines&&(this._linearDepthDefines=n,this._linearDepthPostProcess?.updateEffect(n));let l=this._buildBlurDefines(i);l!==this._blurDefines&&(this._blurDefines=l,this._blurPostProcesses.forEach(s=>s.updateEffect(l)));let p=this._buildComposeDefines(i);p!==this._composeDefines&&(this._composeDefines=p,this._composePostProcess?.updateEffect(p))}_writeLight(e,i,o,r,n,l){let{light:p,config:s}=e,c=i*4;ie(p)?(Re(p,this._temporaryVector),o[c]=-this._temporaryVector.x,o[c+1]=-this._temporaryVector.y,o[c+2]=-this._temporaryVector.z,o[c+3]=1):(et(p,this._temporaryVector).subtractInPlace(this._camera.globalPosition),o[c]=this._temporaryVector.x,o[c+1]=this._temporaryVector.y,o[c+2]=this._temporaryVector.z,o[c+3]=ne(p)?2:0),s.useCustomColor?this._temporaryColor.set(s.color[0],s.color[1],s.color[2]):this._temporaryColor.copyFrom(p.diffuse);let m=p.getScaledIntensity()*s.volumeIntensity*1e-5;r[c]=this._temporaryColor.r*m,r[c+1]=this._temporaryColor.g*m,r[c+2]=this._temporaryColor.b*m,r[c+3]=s.anisotropy,ne(p)?(Re(p,this._temporaryVector),n[c]=this._temporaryVector.x,n[c+1]=this._temporaryVector.y,n[c+2]=this._temporaryVector.z,n[c+3]=Math.cos(p.angle*.5),l[c+1]=p.exponent):(n[c]=0,n[c+1]=0,n[c+2]=1,n[c+3]=-1,l[c+1]=1),l[c]=tt(p,s,this._configuration),l[c+2]=s.castVolumetricShadows?1:0,l[c+3]=s.shadowDarkness}_bindLinearDepth(e){let i=null;switch(this._depthSource){case 2:{let o=ye(this._scene);i=o?vi(o):null;break}case 1:{let o=Ve(this._scene);i=o?Si(o):null;break}default:i=this._depthRenderer?.getDepthMap()??null;break}i&&(e.setTexture("depthSampler",i),this._bindDepthUniforms(e))}_bindScattering(e){let i=this._scene,o=this._camera,r=this._configuration,n=this._selection;if(!n)return;this._inverseViewProjection.copyFrom(i.getTransformMatrix()),this._inverseViewProjection.invert(),e.setMatrix("volInverseViewProjection",this._inverseViewProjection),e.setVector3("volCameraPosition",o.globalPosition),o.getDirectionToRef(i.useRightHandedSystem?la:sa,this._temporaryVector),e.setVector3("volCameraForward",this._temporaryVector.normalize()),e.setFloat2("volCameraMinMaxZ",o.minZ,o.maxZ),e.setFloat("volFrameIndex",i.getRenderId()%64),this._bindDepthRatio(e),e.setFloat4("volFogInfos",r.fogMode,r.fogStart,r.fogEnd,r.fogDensity),this._temporaryColor.set(r.fogColor[0],r.fogColor[1],r.fogColor[2]),e.setColor3("volFogColor",this._temporaryColor),e.setFloat("volLinearFogEps",Math.max((r.fogEnd-r.fogStart)*.02,1e-4)),e.setFloat4("volMedium",r.albedo,r.heightFogBaseHeight,r.heightFogFalloff,0),r.screenSpaceShadows&&(e.setMatrix("volViewProjection",i.getTransformMatrix()),e.setFloat4("volScreenShadowParams",r.screenSpaceShadowMaxDistance,r.screenSpaceShadowBias,r.screenSpaceShadowThickness,0)),this._temporaryColor.set(r.ambientColor[0],r.ambientColor[1],r.ambientColor[2]).scaleInPlace(r.ambientIntensity),e.setColor3("volAmbient",this._temporaryColor);let l=n.unshadowed.length,p=l-n.directionalCount;e.setFloat4("volParams",r.maxDistance,r.ditherStrength,r.lightExtinctionClamp,p);for(let s=0;s<l;++s)this._writeLight(n.unshadowed[s],s,this._lightData,this._lightDiffuse,this._lightDirection,this._lightFalloff);if(l){let s=l*4;e.setFloatArray4("volLightData",this._lightData.subarray(0,s)),e.setFloatArray4("volLightDiffuse",this._lightDiffuse.subarray(0,s)),e.setFloatArray4("volLightDirection",this._lightDirection.subarray(0,s)),e.setFloatArray4("volLightFalloff",this._lightFalloff.subarray(0,s))}if(n.shadowed.forEach((s,c)=>{this._writeLight(s.candidate,c,this._shadowLightData,this._shadowLightDiffuse,this._shadowLightDirection,this._shadowLightFalloff);let{generator:m,kind:h,mode:d,mapSize:f}=s.shadow,S=s.candidate.light,g=c*4;this._shadowLightFalloff[g+2]=m.frustumEdgeFalloff;let b=S.getDepthMinZ?.(i.activeCamera)??0,L=S.getDepthMaxZ?.(i.activeCamera)??1;this._shadowInfo[g]=m.getDarkness(),this._shadowInfo[g+1]=h===1?1/f:d===0?0:m.depthScale,this._shadowInfo[g+2]=b,this._shadowInfo[g+3]=b+L,m.getTransformMatrix().copyToArray(this._shadowMatrices,c*16);let _=m.getShadowMapForRendering();h===1?e.setDepthStencilTexture(`volShadowSampler${c}`,_):e.setTexture(`volShadowSampler${c}`,_)}),n.shadowed.length){let s=n.shadowed.length*4;e.setFloatArray4("volShadowLightData",this._shadowLightData.subarray(0,s)),e.setFloatArray4("volShadowLightDiffuse",this._shadowLightDiffuse.subarray(0,s)),e.setFloatArray4("volShadowLightDirection",this._shadowLightDirection.subarray(0,s)),e.setFloatArray4("volShadowLightFalloff",this._shadowLightFalloff.subarray(0,s)),e.setFloatArray4("volShadowInfo",this._shadowInfo.subarray(0,s)),e.setMatrices("volShadowMatrix",this._shadowMatrices.subarray(0,n.shadowed.length*16))}if(n.csm){let{candidate:s,generator:c,cascades:m,kind:h}=n.csm,d=s.light;this._writeLight(s,0,this._csmLightData,this._csmLightDiffuse,this._csmLightDirection,this._csmLightFalloff),e.setFloat4("volCsmLightData",this._csmLightData[0],this._csmLightData[1],this._csmLightData[2],this._csmLightData[3]),e.setFloat4("volCsmLightDiffuse",this._csmLightDiffuse[0],this._csmLightDiffuse[1],this._csmLightDiffuse[2],this._csmLightDiffuse[3]),e.setFloat4("volCsmLightDirection",this._csmLightDirection[0],this._csmLightDirection[1],this._csmLightDirection[2],this._csmLightDirection[3]),e.setFloat4("volCsmLightFalloff",this._csmLightFalloff[0],this._csmLightFalloff[1],c.frustumEdgeFalloff,s.config.shadowDarkness);let f=d.getDepthMinZ?.(i.activeCamera)??1,S=d.getDepthMaxZ?.(i.activeCamera)??1,g=c.getShadowMap()?.getSize().width??1024;e.setFloat4("volCsmInfo",c.getDarkness(),1/g,f,f+S);for(let L=0;L<m;++L)c.getCascadeTransformMatrix(L)?.copyToArray(this._csmMatrices,L*16);e.setMatrices("volCsmMatrices",this._csmMatrices.subarray(0,m*16));let b=c.getShadowMapForRendering();h===1?e.setDepthStencilTexture("volCsmSampler",b):e.setTexture("volCsmSampler",b)}}_bindDepthRatio(e){let i=this._scatteringPostProcess,o=this._blurPostProcesses[0]??this._composePostProcess,r=i&&i.width>0?i.width:1,n=i&&i.height>0?i.height:1,l=o&&o.width>0?o.width:r,p=o&&o.height>0?o.height:n;e.setFloat2("volDepthRatio",r/l,n/p)}_bindBlur(e,i){this._scatteringPostProcess&&(e.setTextureFromPostProcess("volLinearDepthSampler",this._scatteringPostProcess),e.setFloat2("volCameraMinMaxZ",this._camera.minZ,this._camera.maxZ),this._bindDepthRatio(e),e.setFloat2("volBlurDirection",i%2===0?1:0,i%2===0?0:1),e.setFloat2("volBlurParams",Math.max(this._configuration.blurRadius*.5,.5),this._configuration.blurDepthThreshold))}_bindCompose(e){if(!this._linearDepthPostProcess||!this._scatteringPostProcess)return;let i=this._configuration;e.setTextureFromPostProcess("volSceneSampler",this._linearDepthPostProcess),e.setTextureFromPostProcess("volLinearDepthSampler",this._scatteringPostProcess),e.setFloat2("volCameraMinMaxZ",this._camera.minZ,this._camera.maxZ),this._bindDepthRatio(e);let o=this._ldrEncode?1/255:0;e.setFloat4("volComposeParams",i.intensity,i.extinctionAmount,i.upsampleDepthThreshold,o)}};var M=null,xe=new Map;function ma(){return M?.isDisposed&&(M=null),M}a(ma,"getVolumetricLightingRenderingPipeline");function ha(t){M=t}a(ha,"setVolumetricLightingRenderingPipelineRef");function da(t){let e=t?.getEngine();return e?q.IsSupported(e):!1}a(da,"isVolumetricLightingSupported");function Ci(){M&&(M.dispose(),M=null)}a(Ci,"disposeVolumetricLightingRenderingPipeline");function Xo(t,e,i){return M=new q("VolumetricLightingRenderingPipeline",t,e),M.msaaSamples=i?.msaaSamples??1,M}a(Xo,"createVolumetricLightingRenderingPipeline");function Li(){return M?M.serializeConfiguration():null}a(Li,"serializeVolumetricLightingRenderingPipeline");function Di(t,e,i,o){let r=M??Xo(t,e,o);r.msaaSamples=o?.msaaSamples??1;let n={...i};return n.fogDensity===void 0&&(n.fogDensity=q.GetDefaultFogDensity(r.scene,r.camera)),n.fogEnd===void 0&&(n.fogEnd=q.GetDefaultFogEnd(r.scene,r.camera)),n.screenSpaceShadowMaxDistance===void 0&&(n.screenSpaceShadowMaxDistance=q.GetDefaultFogEnd(r.scene,r.camera)),r.applyConfiguration(Se(n)),r}a(Di,"parseVolumetricLightingRenderingPipeline");function fa(){M?.markLightsDirty()}a(fa,"markVolumetricLightsDirty");var ct=require("babylonjs");function ua(t){ue.set(t,Xt()),he.set(t,Ft()),de.set(t,Bt()),ge.set(t,Zt()),xe.set(t,Li()),ve.set(t,Jt()),fe.set(t,kt())}a(ua,"saveRenderingConfigurationForCamera");function _i(t,e,i){Wt(),Vt(t.getScene()),Gt(),jt(),Ci(),Qt(),Ht();let o=ue.get(t);o&&!i?.ssao2Disabled&&$t(t.getScene(),t,o,i);let r=xe.get(t);r&&!i?.volumetricLightingDisabled&&Di(t.getScene(),t,r,i);let n=he.get(t);n&&!i?.vlsDisabled&&Nt(t.getScene(),n,i);let l=de.get(t);l&&!i?.ssrDisabled&&zt(t.getScene(),t,l,i);let p=ge.get(t);p&&!i?.motionBlurDisabled&&Yt(t.getScene(),t,p,i);let s=ve.get(t);s&&!i?.defaultPipelineDisabled&&ei(t.getScene(),t,s,e,i);let c=fe.get(t);c&&!i?.taaDisabled&&Ut(t.getScene(),t,c,i)}a(_i,"applyRenderingConfigurationForCamera");function ga(t){let e=t.getCaps();return e.textureHalfFloatRender||e.textureFloatRender}a(ga,"canUseHdr");function $(t){let e=t.getCaps();return e.textureHalfFloatRender?ct.Constants.TEXTURETYPE_HALF_FLOAT:e.textureFloatRender?ct.Constants.TEXTURETYPE_FLOAT:ct.Constants.TEXTURETYPE_UNSIGNED_BYTE}a($,"getHdrTextureType");var Ge=require("babylonjs"),$o=require("babylonjs");function Ko(t){let e=t.metadata?.physicsAggregate;if(!e)return;let i;F(t)?i=t:Te(t)&&(i=t.sourceMesh);let o=new $o.PhysicsAggregate(t,e.shape.type,{mesh:i,mass:e.massProperties.mass});o.body.setMassProperties({mass:e.massProperties.mass,inertia:e.massProperties.inertia?Ge.Vector3.FromArray(e.massProperties.inertia):void 0,centerOfMass:e.massProperties.centerOfMass?Ge.Vector3.FromArray(e.massProperties.centerOfMass):void 0,inertiaOrientation:e.massProperties.inertiaOrientation?Ge.Quaternion.FromArray(e.massProperties.inertiaOrientation):void 0}),o.shape.density=e.shape.density,o.body.setMotionType(e.body.motionType),o.shape.material=e.material,t.physicsAggregate=o,t.metadata.physicsAggregate=void 0}a(Ko,"configurePhysicsAggregate");function jo(t,e){(Array.isArray(e)?e:[]).forEach(o=>{let r=t.getCameraById(o.cameraId);r&&(o.ssao2RenderingPipeline&&ue.set(r,o.ssao2RenderingPipeline),o.vlsPostProcess&&he.set(r,o.vlsPostProcess),o.ssrRenderingPipeline&&de.set(r,o.ssrRenderingPipeline),o.motionBlurPostProcess&&ge.set(r,o.motionBlurPostProcess),o.volumetricLightingRenderingPipeline&&xe.set(r,o.volumetricLightingRenderingPipeline),o.defaultRenderingPipeline&&ve.set(r,o.defaultRenderingPipeline),o.taaRenderingPipeline&&fe.set(r,o.taaRenderingPipeline))})}a(jo,"applyRenderingConfigurations");var Zo=require("babylonjs");function Ce(t,e,i){return new Promise((o,r)=>{let n=new Zo.WebRequest;n.open("GET",t),n.responseType=e,n.send(),n.addEventListener("progress",l=>{i?.({total:l.total,loaded:l.loaded})}),n.addEventListener("load",()=>{o(e==="text"?n.responseText:n.response)}),n.addEventListener("error",l=>r(l))})}a(Ce,"loadFile");async function z(t,e){let i=await Ce(t,"text",e);return JSON.parse(i)}a(z,"loadJsonFile");function Pi(t,e){let i=e.getNodeByName(t);if(i)return i;let o=e.lights.filter(r=>pe(r));for(let r of o){let n=r.lights.find(l=>l.name===t);if(n)return n}return null}a(Pi,"getNodeByName");function Le(t,e){let i=e.getNodeById(t);if(i)return i;let o=e.lights.filter(r=>pe(r));for(let r of o){let n=r.lights.find(l=>l.id===t);if(n)return n}return null}a(Le,"getNodeById");var le=require("babylonjs"),Yo=require("babylonjs");function wi(t){let e=Yo.Vector3.FromArray(t);return e.equals(le.Axis.X)?le.Axis.X:e.equals(le.Axis.Y)?le.Axis.Y:e.equals(le.Axis.Z)?le.Axis.Z:e}a(wi,"parseAxis");var qo=require("babylonjs"),Q=require("babylonjs");function Qo(t){return t.runtimeConfiguration.forEach(e=>{e.rotationAxis&&(e.rotationAxis=wi(e.rotationAxis)),e.boneOffsetAxis&&(e.boneOffsetAxis=wi(e.boneOffsetAxis))}),t}a(Qo,"parseRagdollConfiguration");function Oi(t){let e={rootNodeId:t.rootNodeId,skeletonName:t.skeletonName,scalingFactor:t.scalingFactor,runtimeConfiguration:t.runtimeConfiguration.map(i=>({name:i.name,bones:i.bones,width:i.width,depth:i.depth,height:i.height,size:i.size,joint:i.joint,min:i.min,max:i.max,mass:i.mass??1,boxOffset:i.boxOffset,restitution:i.restitution??0,rotationAxis:i.rotationAxis?.slice(),boneOffsetAxis:i.boneOffsetAxis?.slice()}))};return Qo(e)}a(Oi,"copyAndParseRagdollConfiguration");function va(t,e){let i=t.getConstraints(),r=t._skeleton?.getChildren()[0],n=[];if(e.forEach(p=>{(p.bone!==void 0?[p.bone]:p.bones).forEach(c=>{c!==r?.name&&n.push(p)})}),n.length!==i.length)return qo.Logger.Warn("Failed to apply the ragdoll joint limits: the constraints of the ragdoll don't match its configuration."),0;let l=0;return i.forEach((p,s)=>{let c=n[s];if((c.joint??Q.PhysicsConstraintType.HINGE)!==Q.PhysicsConstraintType.HINGE||c.min===void 0||c.max===void 0)return;let h=Math.min(c.min,c.max),d=Math.max(c.min,c.max),f=p._physicsPlugin;f&&(f.setAxisMode(p,Q.PhysicsConstraintAxis.ANGULAR_X,Q.PhysicsConstraintAxisLimitMode.LIMITED),f.setAxisMinLimit(p,Q.PhysicsConstraintAxis.ANGULAR_X,h*Math.PI/180),f.setAxisMaxLimit(p,Q.PhysicsConstraintAxis.ANGULAR_X,d*Math.PI/180),++l)}),l}a(va,"applyRagdollJointLimits");function Sa(t){return new Promise(e=>{setTimeout(()=>e(),t)})}a(Sa,"waitMs");async function Ei(t){for(;!t();)await Sa(150)}a(Ei,"waitUntil");function Ti(t){return t&&JSON.parse(JSON.stringify(t))}a(Ti,"cloneJSObject");var Ii=require("babylonjs"),nr=require("babylonjs"),pt=require("babylonjs"),ar=require("babylonjs"),sr=require("babylonjs"),lr=require("babylonjs"),oe=require("babylonjs"),Jo=!1,er=null,De=[],Ai=new Map;function ya(t,e){let i=(0,oe._GetAudioEngine)(null);return new lr._WebAudioStaticSound(t,i,e)}a(ya,"createSoundInstance");function tr(t){if(er?.remove(),!De.length)return;let e=Ii.Vector3.Zero();er=t.onBeforeRenderObservable.add(()=>{let i=(0,oe._GetAudioEngine)(null).listener.attachedNode;i&&(i.getWorldMatrix().getTranslationToRef(e),De.forEach(o=>{o.isEnabled(!1)&&o.autoUpdateSpatial&&o.sound?._isSpatial&&o.isPlaying()&&t.activeCamera&&Ii.Vector3.Distance(e,o.getAbsolutePosition())<=o.sound.spatial.maxDistance&&o.sound.spatial.update()}))})}a(tr,"registerUpdateSoundsObserver");function ir(t,e){e.onDisposeObservable.addOnce(()=>{let i=De.indexOf(t);i!==-1&&De.splice(i,1)})}a(ir,"registerSoundInstanceCleanup");function or(t){t.sound&&ir(t,t.sound),t.onDisposeObservable.addOnce(()=>{t.sound?.dispose()})}a(or,"registerSoundNodeEvents");function ba(t,e){return new Promise(async(i,o)=>{if(!t.offlineProvider||!nr.Database.IDBStorageEnabled)return(0,oe.CreateSoundBufferAsync)(e).then(r=>i(r)).catch(r=>o(r));t.offlineProvider.loadFile(e,r=>{(0,oe.CreateSoundBufferAsync)(r).then(n=>i(n)).catch(n=>o(n))},void 0,()=>{o(null)},!0)})}a(ba,"loadSoundBuffer");function Mi(t,e){if(!t.soundRelativePath||!t.sound)return;e.onSoundLoadedObservable=new ar.Observable;let i=ya(t.soundRelativePath,{spatialAutoUpdate:!1});i._initAsync(t.sound.buffer,{spatialAutoUpdate:!0}).then(()=>{i.volume=t.volume,i._isSpatial=t.sound._isSpatial,i._isSpatial&&(i.spatial.attach(e),i.spatial.maxDistance=t.sound.spatial.maxDistance,i.spatial.panningModel=t.sound.spatial.panningModel,i.spatial.distanceModel=t.sound.spatial.distanceModel),e.sound=i,e.soundRelativePath=t.soundRelativePath,e.autoUpdateSpatial=t.autoUpdateSpatial,De.push(e),ir(e,i),tr(e.getScene()),e.onSoundLoadedObservable.notifyObservers(e)}),or(e),rr(e,i)}a(Mi,"configureSourceNodeFrom");function rr(t,e){Object.defineProperty(t,"volume",{get:a(()=>e.volume,"get"),set:a(i=>{e.volume=i},"set")}),Object.defineProperty(t,"playbackRate",{get:a(()=>e.playbackRate,"get"),set:a(i=>{e.playbackRate=i},"set")}),t.isPaused=()=>e.state===pt.SoundState.Paused,t.isPlaying=()=>e.state===pt.SoundState.Started,t.isStopped=()=>e.state===pt.SoundState.Stopped,t.pause=()=>e.pause(),t.resume=()=>e.resume(),t.stop=i=>e.stop(i),t.play=i=>e.play(i),t.setVolume=(i,o)=>e.setVolume(i,o),t.getClassName=()=>"SoundNode",t.setSoundSpatial=i=>new Promise(o=>{e._isSpatial=i,setTimeout(()=>{i&&e.spatial.attach(t),o()})}),t.cloneAsync=async(i,o,r)=>new Promise(n=>{let l=t.clone(i,o,r);Mi(t,l),l.onSoundLoadedObservable.addOnce(()=>{setTimeout(()=>n(l))})})}a(rr,"configureSoundNodePrototype");function cr(){Jo||(Jo=!0,(0,sr.AddParser)("SoundNode",(t,e,i,o)=>{t.transformNodes?.forEach(r=>{if(!r.isSoundNode)return;let n=i.transformNodes?.find(l=>l.id===r.id);if(n&&r.soundRelativePath){let l=`${o}${r.soundRelativePath}`;e.addPendingData(l),Ai.has(l)||Ai.set(l,ba(e,l)),Ai.get(l).then(s=>{(0,oe.CreateSoundAsync)(r.soundRelativePath,s,{spatialAutoUpdate:!1}).then(c=>{if(e.removePendingData(l),n.isDisposed())return c.dispose();c.volume=r.volume,c._isSpatial=r.isSpatial,r.isSpatial&&(c.spatial.attach(n),c.spatial.maxDistance=r.maxDistance,c.spatial.panningModel=r.panningModel,c.spatial.distanceModel=r.distanceModel),n.sound=c,n.soundRelativePath=r.soundRelativePath,n.autoUpdateSpatial=r.autoUpdateSpatial,De.push(n),or(n),rr(n,c),tr(e)})})}})}))}a(cr,"registerAudioParser");var pr=require("babylonjs");function _e(t){let e=new Set;[...t.transformNodes,...t.meshes].forEach(o=>{if(o.metadata?.isStaticGroup){let r=o.getDescendants(!1);r.push(o),r.forEach(n=>{if((re(n)||te(n)&&!n.isWorldMatrixFrozen)&&n.billboardMode===pr.AbstractMesh.BILLBOARDMODE_NONE&&n.freezeWorldMatrix(),re(n)){let l=n.material;l&&!l.isFrozen&&!e.has(l)&&(e.add(l),l.onBindObservable.addOnce(()=>{l.freeze()}))}})}})}a(_e,"configureTransformNodes");var Be=class{constructor(e,i){this.entries=e;this.namingId=i}entries;namingId;static{a(this,"AdvancedAssetContainerInstantiatedEntries")}get rootNodes(){return this.entries.rootNodes}get skeletons(){return this.entries.skeletons}get animationGroups(){return this.entries.animationGroups}dispose(){this.entries.dispose()}getRootNodeByName(e){let i=`${e}-${this.namingId}`;return this.entries.rootNodes.find(o=>o.name===i)??null}getNodeByName(e){let i=`${e}-${this.namingId}`;for(let o of this.entries.rootNodes){let r=this._recursivelyGetNodeByName(i,o);if(r)return r}return null}_recursivelyGetNodeByName(e,i){if(i.name===e)return i;for(let o of i.getDescendants(!0)){let r=this._recursivelyGetNodeByName(e,o);if(r)return r}return null}getScriptByClassByObjectName(e,i){let o=this.getNodeByName(e);if(o){let r=Pe(o,i);if(r?.length===1)return r[0]}return null}};var Ri=require("babylonjs"),ze=class{static{a(this,"AdvancedAssetContainer")}container;_rootUrl;_scriptsMap;_originalDescendants=[];_nodesMap=new Map;_animationGroupsMap=new Map;constructor(e,i,o){this.container=e,this._rootUrl=i,this._scriptsMap=o,e.populateRootNodes(),e.rootNodes.forEach(r=>{this._originalDescendants.push(r,...r.getDescendants(!1))}),e.animationGroups.forEach(r=>{this._animationGroupsMap.set(r.name,r)}),this._originalDescendants.forEach(r=>{this._nodesMap.set(r,{node:r,metadata:Ti(r.metadata)})})}removeDefault(){this.container.getNodes().forEach(e=>{H.get(e)?.forEach(o=>{mt(e,o)})}),this.container.removeAllFromScene()}getRootNodeByName(e){return this.container.rootNodes.find(i=>i.name===e)??null}getScriptByClassByObjectName(e,i){let o=this.container.getNodes();for(let r of o)if(r.name===e){let n=Pe(r,i);if(n?.length===1)return n[0]}return null}instantiate(e){let i=Ri.Tools.RandomId(),o=a(s=>s,"nameFunction"),r=this.container.instantiateModelsToScene(o,!1,{...e,predicate:a(s=>(s.name=`${s.name}@editor-tools@${i}_${s.id}`,e?.predicate?.(s)??!0),"predicate")}),n=new Be(r,i);[...this.container.transformNodes,...this.container.meshes,...this.container.lights,...this.container.cameras,...this.container.animationGroups,...this.container.skeletons].forEach(s=>{let c=s.name.split("@editor-tools@");s.name=c[0]}),r.animationGroups.forEach(s=>{let c=s.name.split("@editor-tools@");s.name=`${c[0]}-${i}`});let p=[];return r.rootNodes.forEach(s=>{p.push(s,...s.getDescendants(!1))}),p.forEach(s=>{let c=s.name.split("@editor-tools@"),m=c[1].split("_").pop();s.name=`${c[0]}-${i}`;let h=this._originalDescendants.find(d=>d.id===m);ae(h)&&te(s)&&Mi(h,s),s.id=Ri.Tools.RandomId(),s.metadata=Ti(this._nodesMap.get(h).metadata),s.metadata??={},s.metadata.originalId=m,p.forEach(d=>{d.metadata.scripts?.forEach(f=>{Object.keys(f.values||{}).forEach(g=>{let b=f.values[g];if(b.type==="entity"){b.value===m&&(b.value=s.id),b.value===h.name&&(b.value=s.name);let L=this._animationGroupsMap.get(b.value);L&&(b.value=`${L.name}-${i}`)}})})})}),p.forEach(s=>{B(this.container.scene,s,this._scriptsMap,this._rootUrl)}),_e(this.container.scene),n}};var mr=require("babylonjs"),hr=require("babylonjs");async function dr(t,e,i){let o=i.iblIntensity,r=i.environmentIntensity,l=t.split("/").pop().replace(".scene",".babylon"),p=await(0,hr.LoadAssetContainerAsync)(l,i,{rootUrl:e,pluginExtension:".babylon"});return mr.SceneLoaderFlags.ForceFullSceneLoadingForIncremental&&i.meshes.forEach(s=>F(s)&&s._checkDelayState()),p.addAllToScene(),i.iblIntensity=o,i.environmentIntensity=r,_e(i),p}a(dr,"preloadSceneScriptAsset");async function fr(t,e){return z(`${e}${t}`)}a(fr,"preloadCommonScriptAsset");var I=new Map,He=new Map;function xa(t,e){He.has(t)&&console.warn(`A parser for the extension '${t}' was already registered. It will be overwritten.`),He.set(t,e)}a(xa,"registerScriptAssetParser");async function Vi(t,e,i){[e,...e.transformNodes,...e.meshes,...e.lights,...e.cameras].filter(p=>p.metadata?.scripts?.length).map(p=>p.metadata.scripts).flat().forEach(p=>{if(i[p.key]?.default?._SceneAssets?.forEach(c=>{I.get(c.sceneName)||I.set(c.sceneName,null)}),p.values)for(let c in p.values){if(!p.values.hasOwnProperty(c))continue;let m=p.values[c];m.type==="asset"&&m.value&&!I.get(m.value)&&I.set(m.value,null)}});let n=0;for(let p of I.values())p===null&&++n;if(n===0)return n;let l=[];return I.forEach((p,s)=>{I.get(s)||l.push(new Promise(async c=>{try{let m=s.split(".").pop();switch(m){case"scene":let h=await dr(s,t,e);e.onDisposeObservable.addOnce(()=>{h.dispose(),I.delete(s)}),I.set(s,new ze(h,t,i));break;default:if(He.has(m)){let d=He.get(m);I.set(s,await d({key:s,rootUrl:t,scene:e}));break}else I.set(s,await fr(s,t));break}}catch(m){console.error(m)}c()}))}),await Promise.all(l),n}a(Vi,"_preloadScriptsAssets");var ur=require("babylonjs"),ht=require("babylonjs"),gr=require("babylonjs"),dt=require("babylonjs"),vr=require("babylonjs"),Sr=require("babylonjs-gui");function Fi(t,e,i,o,r){let n=o.constructor;if(!n)return;n._NodesFromScene?.forEach(s=>{o[s.propertyKey.toString()]=Pi(s.nodeName,t)}),n._ComponentsFromScene?.length&&t.getEngine().onBeginFrameObservable.addOnce(()=>{n._ComponentsFromScene?.forEach(s=>{let c=[];if([t,...t.transformNodes,...t.meshes,...t.lights,...t.cameras].forEach(h=>{let d=Ni(h,s.componentConstructor);d&&c.push(d)}),c.length>1)throw new Error(`Multiple components of type ${n._ComponentsFromScene[0].componentConstructor.name} found in scene for property "${n._ComponentsFromScene[0].propertyKey.toString()}".`);o[s.propertyKey.toString()]=c[0]??null})}),n._NodesFromDescendants?.forEach(s=>{let c=e.getDescendants?.(s.directDescendantsOnly,m=>m.name===s.nodeName)[0];o[s.propertyKey.toString()]=c??null}),n._AnimationGroups?.forEach(s=>{o[s.propertyKey.toString()]=t.getAnimationGroupByName(s.animationGroupName)}),n._SoundsFromScene?.forEach(s=>{let c=Pi(s.soundName,t);c&&ae(c)&&(o[s.propertyKey.toString()]=c??null)}),(n._GuiFromAsset??[]).map(async s=>{let c=`${r}assets/${s.pathInAssets}`;try{let m=await z(c),h=Sr.AdvancedDynamicTexture.CreateFullscreenUI(m.name,!0,t);h.parseSerializedObject(m.content,!1),o[s.propertyKey.toString()]=h,s.onGuiCreated?.(o,h)}catch(m){throw console.error(`Failed to load GUI from asset: ${c}`),m}}),n._ParticleSystemsFromScene?.forEach(s=>{let c=t.particleSystems?.find(m=>m.name!==s.particleSystemName?!1:s.directDescendantsOnly?m.emitter===e:m);o[s.propertyKey.toString()]=c}),(n._VisibleInInspector??[]).forEach(s=>{let c=s.propertyKey.toString(),m=i.values;if(!m)throw new Error(`No values found for script with key "${i.key}".`);if(m.hasOwnProperty(c)&&m[c].hasOwnProperty("value")){let h=m[c].value;switch(s.configuration.type){case"number":case"boolean":case"keymap":case"string":o[c]=h;break;case"vector2":o[c]=dt.Vector2.FromArray(h);break;case"vector3":o[c]=dt.Vector3.FromArray(h);break;case"color3":o[c]=ht.Color3.FromArray(h);break;case"color4":o[c]=ht.Color4.FromArray(h);break;case"entity":switch(s.configuration.entityType){case"node":case"sound":o[c]=Le(h,t)??null;break;case"animationGroup":o[c]=t.getAnimationGroupByName(h)??null;break;case"particleSystem":o[c]=t.particleSystems?.find(f=>f.id===h)??null;break}break;case"texture":h&&(o[c]=gr.Texture.Parse(h,t,r));break;case"asset":if(h){let f=s.configuration.assetType,S=I.get(h);switch(f){case"json":case"gui":case"scene":case"navmesh":case"cinematic":o[c]=S;break;case"ragdoll":o[c]=Oi(S);break;case"nodeParticleSystemSet":let g=vr.NodeParticleSystemSet.Parse(S);o[c]=g;break;case"material":o[c]=ur.Material.Parse(S,t,r);break}}}}});let l=null,p=null;if(n._PointerEvents?.length){if(n._PointerEvents.find(m=>m.options.mode==="attachedMeshOnly")&&!re(e))throw new Error('@onPointerEvent with mode "attachedMeshOnly" can only be used on scripts attached to meshes (extends AbstractMesh).');if(n._PointerEvents.find(m=>m.options.mode!=="global")&&!me(e))throw new Error('@onPointerEvent with mode different from "global" can be used only on scripts attached to Node: Mesh, Light, Camera, TransformNode.');l=t.onPointerObservable.add(m=>{let h=null;n._PointerEvents.forEach(d=>{if(!d.eventTypes.includes(m.type))return;let f=d.propertyKey.toString();if(d.options.mode==="global")return o[f]?.(m);h=m.pickInfo,h||(h=t.pick(t.pointerX,t.pointerY,g=>g.isVisible&&g.isPickable&&g.isEnabled(!0)&&!g._masterMesh,!1));let S=h.pickedMesh;if(S&&(d.options.mode==="attachedMeshOnly"&&S===e||d.options.mode==="includeDescendants"&&me(e)&&[e,...e.getDescendants(!1)].find(L=>L===S)))return o[f]?.(m)})})}if(n._KeyboardEvents?.length&&(p=t.onKeyboardObservable.add(s=>{n._KeyboardEvents.forEach(c=>{c.eventTypes.includes(s.type)&&o[c.propertyKey.toString()]?.(s)})})),n._SpritesFromSpriteManager?.length){let s=e;if(!te(s)||!s.isSpriteManager)return console.error("@spriteFromSpriteManager decorator can only be used on SpriteManagerNode.");if(!s.spriteManager)return console.error(`SpriteManagerNode "${s.name}" has no sprite manager assigned.`);n._SpritesFromSpriteManager?.forEach(c=>{let m=s.spriteManager?.sprites.find(h=>h.name===c.spriteName)||null;o[c.propertyKey.toString()]=m})}if(n._AnimationsFromSprite?.length){if(!Ot(e))return console.error("@animationFromSprite decorator can only be used in scripts attached on Sprite.");let s=e.metadata?.spriteAnimations;if(!s?.length)return console.error(`Sprite "${e.name}" has no sprite animations assigned.`);n._AnimationsFromSprite.forEach(c=>{let m=s.find(h=>h.name===c.animationName);m?o[c.propertyKey.toString()]=m??null:console.warn(`Sprite animation named "${c.animationName}" not found on sprite "${e.name}".`)})}return n._SceneAssets?.forEach(s=>{o[s.propertyKey.toString()]=I.get(s.sceneName)}),{observers:{pointerObserver:l,keyboardObserver:p}}}a(Fi,"applyDecorators");function B(t,e,i,o){e.metadata?.scripts&&(e.metadata.scripts?.forEach(r=>{if(!r.enabled)return;let n=i[r.key];if(!n)return;let l=n,p={};if(n.default){l=new n.default(e);let s=Fi(t,e,r,l,o);Object.assign(p,s?.observers??{})}l.onStart&&(p.onStartObserver=t.onBeforeRenderObservable.addOnce(()=>l.onStart(e))),l.onUpdate&&(p.onUpdateObserver=t.onBeforeRenderObservable.add(()=>l.onUpdate(e))),Gi(e,l,r.key,p)}),e.metadata.scripts=void 0)}a(B,"_applyScriptsForObject");function Ca(t,e,i){if(i??=t.getScene?.(),!i)throw new Error("Cannot apply script on object: no scene available.");let o=new e(t),r={};return Fi(i,t,{values:{}},o,""),o.onStart&&(r.onStartObserver=i.onBeforeRenderObservable.addOnce(()=>o.onStart())),o.onUpdate&&i.onBeforeRenderObservable.add(()=>o.onUpdate()),Gi(t,o,"runtime",r),o}a(Ca,"applyScriptOnObject");var H=new Map;function Gi(t,e,i,o){let r={key:i,observers:o,instance:e};H.has(t)?H.get(t).push(r):H.set(t,[r]),(me(t)||wt(t)||_t(t)||ae(t))&&t.onDisposeObservable.addOnce((()=>{H.get(t)?.slice()?.forEach(l=>{mt(t,l)}),H.delete(t)}))}a(Gi,"_registerScriptInstance");function mt(t,e){e.observers.onStartObserver?.remove(),e.observers.onUpdateObserver?.remove(),e.observers.pointerObserver?.remove(),e.observers.keyboardObserver?.remove();try{e.instance.onStop?.(t)}catch(r){console.error(`Failed to call onStop for script ${e.key} on object ${t}`,r)}let i=H.get(t),o=i?.indexOf(e)??-1;o!==-1&&i?.splice(o,1)}a(mt,"_removeRegisteredScriptInstance");function Pe(t,e){return H.get(t)?.filter(r=>r.instance.constructor===e)?.map(r=>r.instance)??null}a(Pe,"getAllScriptsByClassForObject");function Ni(t,e){return Pe(t,e)?.[0]??null}a(Ni,"getScriptByClassForObject");var br=require("babylonjs"),yr=!1;function xr(){yr||(yr=!0,(0,br.AddParser)("MeshEditorPlugin",(t,e,i,o)=>{t.meshes?.forEach(r=>{r.instances?.forEach(n=>{let l=i.meshes?.find(p=>p.id===n.id);l&&n.billboardMode!==void 0&&(l.billboardMode=n.billboardMode)})})}))}a(xr,"registerMeshParser");var Cr=!1;function La(t){Cr=t}a(La,"setUseKtx2CompressedTextures");function ke(){return Cr}a(ke,"isUsingKtx2CompressedTextures");function ft(t){return`${t.substring(0,t.lastIndexOf("."))}.ktx2`}a(ft,"_getKtx2TextureName");function Da(t){t.setCompressedTextureExclusions([".env",".hdr",".dds"]),t.setTextureFormatToUse(["-dxt.ktx","-astc.ktx","-pvrtc.ktx","-etc1.ktx","-etc2.ktx"])}a(Da,"configureEngineToUseCompressedTextures");function ut(t,e){t._excludedCompressedTextures&&!t._excludedCompressedTextures?.includes(e)&&t._excludedCompressedTextures?.push(e)}a(ut,"addExcludedCompressedTexture");function _a(t,e,i){e.loadingTexturesQuality!==t&&(e.loadingTexturesQuality=t,e.textures.forEach(o=>{if(!Ae(o)||!o.url)return;let r=gt(o,e);!r||o.url.includes(r)||o.updateURL(i+r)}))}a(_a,"applyTexturesQuality");function gt(t,e){if(e.loadingTexturesQuality==="high"||!t.metadata?.baseSize)return t.name;let i=t.metadata.baseSize.width,o=t.metadata.baseSize.height,r=i===N(i)||o===N(o),n="";switch(e.loadingTexturesQuality){case"medium":let d=i*.66>>0,f=o*.66>>0;r&&(d=N(d),f=N(f)),n=`_${d}_${f}`;break;case"low":case"very-low":let S=i*.33>>0,g=o*.33>>0;r&&(S=N(S),g=N(g)),n=`_${S}_${g}`;break}let l=t.name;if(!l||!n)return t.name;let p=l.split("/"),s=p.pop();if(!s)return t.name;let c=s.split(".").pop(),h=`${s.replace(`.${c}`,"")}${n}.${c}`;return p.push(h),p.join("/")}a(gt,"getTextureUrl");var Bi=require("babylonjs"),Lr=!1;function Dr(){if(Lr)return;Lr=!0;let t=Bi.SerializationHelper._TextureParser;Bi.SerializationHelper._TextureParser=(e,i,o)=>{ke()&&(e.name&&(e.name=ft(e.name)),e.url&&(e.url=ft(e.url)));let r=gt(e,i);if(!r)return t(e,i,o);let n=e.name;e.name=r;let l=t(e,i,o);return l&&(l.name=n),l}}a(Dr,"registerTextureParser");function zi(t){if(!Array.isArray(t.frames)){let e=[];for(let i of Object.keys(t.frames))e.push({filename:i,...t.frames[i]});t.frames=e}}a(zi,"normalizeAtlasJson");function Pa(t,e,i){let r=(t.metadata?.spriteAnimations??[]).find(n=>n.name===e);if(!r)return console.error(`Animation with name "${e}" not found on sprite.`);t.playAnimation(r.from,r.to,r.loop,r.delay,i)}a(Pa,"playSpriteAnimationFromName");var Pr=require("babylonjs"),wr=require("babylonjs"),Or=require("babylonjs"),Er=require("babylonjs"),Hi=require("babylonjs"),we=require("babylonjs"),Tr=require("babylonjs"),_r=!1;function Ar(){_r||(_r=!0,(0,Tr.AddParser)("SpriteMapNode",(t,e,i,o)=>{t.transformNodes?.forEach(r=>{if(!r.isSpriteMap)return;let n=i.transformNodes?.find(s=>s.id===r.id);if(!n)return;n.isSpriteMap=r.isSpriteMap;let l=`${o}${r.atlasJsonRelativePath}`;e.addPendingData(l);let p=new Or.WebRequest;p.open("GET",l),p.send(),p.addEventListener("load",()=>{e.removePendingData(l);let s=JSON.parse(p.responseText);zi(s);let c=`${Pr.Tools.GetFolderPath(l)}${s.meta.image}`,m=new Hi.Texture(c,e,!1,!1,Hi.Texture.NEAREST_NEAREST,null,null,null,!1,wr.Engine.TEXTUREFORMAT_RGBA),h=new Er.SpriteMap(n.name,s,m,{layerCount:r.options.layerCount,stageSize:we.Vector2.FromArray(r.options.stageSize??[10,1]),outputSize:we.Vector2.FromArray(r.options.outputSize??[100,100]),colorMultiply:we.Vector3.FromArray(r.options.colorMultiply??[1,1,1]),flipU:!0},e);r.getClassName=()=>"SpriteMapNode",r.tiles.forEach(f=>{for(let S=0,g=f.repeatCount.x+1;S<g;++S)for(let b=0,L=f.repeatCount.y+1;b<L;++b){let _=S*(f.repeatOffset.x+1),x=b*(f.repeatOffset.y+1);h.changeTiles(f.layer,new we.Vector2(f.position.x+_,(h.options.stageSize?.y??0)-1-f.position.y-x),f.tile)}});let d=h._output;d.parent=n,n.spriteMap=h})})}))}a(Ar,"registerSpriteMapParser");var Mr=require("babylonjs"),Rr=require("babylonjs"),vt=require("babylonjs"),Vr=require("babylonjs"),Ir=!1;function Fr(){if(Ir)return;Ir=!0,(0,Vr.RegisterShadowGeneratorSceneComponent)(Rr.ShadowGenerator);let t=(0,vt.GetParser)(Mr.SceneComponentConstants.NAME_SHADOWGENERATOR);(0,vt.AddParser)("ShadowGeneratorEditorPlugin",(e,i,o,r)=>{let n=new Map;e.shadowGenerators?.forEach(l=>{if(n.set(l.id,l.mapSize),i.loadingShadowsQuality!=="high"){switch(i.loadingShadowsQuality){case"medium":l.mapSize=l.mapSize*.5;break;case"low":l.mapSize=l.mapSize*.25;break;case"very-low":l.mapSize=l.mapSize*.125;break}l.mapSize=Math.max(128,N(l.mapSize))}}),t?.(e,i,o,r),i.lights.forEach(l=>{let p=l.getShadowGenerator();if(p?.getShadowMap()){let c=p.id,m=n.get(c);m&&(p.originalMapSize=m)}})})}a(Fr,"registerShadowGeneratorParser");var Br=require("babylonjs"),zr=require("babylonjs"),Hr=require("babylonjs"),ki=require("babylonjs"),kr=require("babylonjs");function Nr(t,e){e?.fogEnabled!==void 0&&(t.fogEnabled=e?.fogEnabled),e?.blendMode!==void 0&&(t.blendMode=e?.blendMode),e?.disableDepthWrite!==void 0&&(t.disableDepthWrite=e?.disableDepthWrite),e?.pixelPerfect!==void 0&&(t.pixelPerfect=e?.pixelPerfect),e?.useLogarithmicDepth!==void 0&&(t.useLogarithmicDepth=e?.useLogarithmicDepth),e?.metadata!==void 0&&(t.metadata=e?.metadata);for(let i of e?.sprites??[]){let o=zr.Sprite.Parse(i,t);o.uniqueId=i.uniqueId,o.metadata=i.metadata}}a(Nr,"parseSerializedSpriteManager");var Gr=!1;function Ur(){Gr||(Gr=!0,(0,kr.AddParser)("SpriteManagerNode",(t,e,i,o)=>{t.transformNodes?.forEach(r=>{if(!r.isSpriteManager)return;let n=i.transformNodes?.find(p=>p.id===r.id);if(!n)return;let l=e.getEngine();if(n.isSpriteManager=r.isSpriteManager,r.atlasJsonRelativePath){let p=`${o}${r.atlasJsonRelativePath}`;e.addPendingData(p);let s=new Hr.WebRequest;s.open("GET",p),s.send(),s.addEventListener("load",()=>{e.removePendingData(p);let c=JSON.parse(s.responseText),m=`${Br.Tools.GetFolderPath(p)}${c.meta.image}`;ut(l,m);let h=new ki.SpriteManager(n.name,m,1e3,64,e,void 0,void 0,!0,c);n.spriteManager=h,n.getClassName=()=>"SpriteManagerNode",r.spriteManager&&Nr(h,r.spriteManager)})}else if(r.spriteManager?.textureUrl){ut(l,r.spriteManager.textureUrl);let p=`${o}${r.spriteManager.textureUrl}`,s=new ki.SpriteManager(n.name,p,1e3,{width:r.spriteManager.cellWidth,height:r.spriteManager.cellHeight},e,void 0,void 0,!1);n.spriteManager=s,n.getClassName=()=>"SpriteManagerNode",r.spriteManager&&Nr(s,r.spriteManager)}})}))}a(Ur,"registerSpriteManagerParser");var Xr=require("babylonjs"),$r=require("babylonjs"),Wr=!1;function Kr(){Wr||(Wr=!0,(0,$r.AddParser)("MorphTargetManagerEditorPlugin",(t,e,i,o)=>{t.morphTargetManagers.forEach(r=>{let l=i.meshes.find(c=>c.id===r.meshId)?.morphTargetManager;if(!l||r.targets.find(c=>!c.delayLoadingFile))return;let s=[];r.targets.forEach(c=>{if(!c.delayLoadingFile)return s.push(Promise.resolve(null));let m=`${o}${c.delayLoadingFile}`;e.addPendingData(m);let h=new Xr.WebRequest;h.responseType="arraybuffer",h.open("GET",m),h.send(),s.push(new Promise(d=>{h.addEventListener("load",()=>{e.removePendingData(m),d(h.response)})}))}),Promise.all(s).then(c=>{for(let m=0,h=l.numTargets;m<h;++m){let d=l.getTarget(m),f=r.targets[m],S=c[m];if(f.positionsCount){let g=new Float32Array(S,f.positionsOffset,f.positionsCount);d._positions=g,d.setPositions(g)}if(f.normalsCount){let g=new Float32Array(S,f.normalsOffset,f.normalsCount);d._normals=g,d.setNormals(g)}if(f.tangentsCount){let g=new Float32Array(S,f.tangentsOffset,f.tangentsCount);d._tangents=g,d.setTangents(g)}if(f.uvsCount){let g=new Float32Array(S,f.uvsOffset,f.uvsCount);d._uvs=g,d.setUVs(g)}if(f.uv2sCount){let g=new Float32Array(S,f.uv2sOffset,f.uv2sCount);d._uv2s=g,d.setUV2s(g)}}for(let m=0,h=l.numTargets;m<h;++m)l.getTarget(m)._onDataLayoutChanged.notifyObservers()})})}))}a(Kr,"registerMorphTargetManagerParser");var Zr=require("babylonjs"),Yr=require("babylonjs"),jr=!1;function qr(){jr||(jr=!0,(0,Zr.AddParser)("NodeParticleSystemSetEditorPlugin",(t,e,i,o)=>{t.meshes?.forEach(r=>{if(!r.isNodeParticleSystemMesh)return;let n=i.meshes?.find(l=>l.id===r.id);n&&(r.nodeParticleSystemSet.blocks?.forEach(l=>{l.url&&(l.url=`${o}${l.url}`)}),n.nodeParticleSystemSet=Yr.NodeParticleSystemSet.Parse(r.nodeParticleSystemSet),n.nodeParticleSystemSet.id=r.nodeParticleSystemSet.id,n.nodeParticleSystemSet.uniqueId=r.uniqueId,e.addPendingData(r.id),n.nodeParticleSystemSet.buildAsync(e,!1).then(l=>{e.removePendingData(r.id),n.particleSystemSet=l,l.systems.forEach(p=>{if(Pt(p)){let s=p._sizeCreation.process;s&&(p._sizeCreation.process=(c,m)=>{s(c,m),c.scale.x*=100,c.scale.y*=100})}}),l.emitterNode=n,l.start()}))})}))}a(qr,"registerNodeParticleSystemSetParser");var Qr=require("babylonjs");function Jr(t,e){e??=new Qr.ClusteredLightContainer("Clustered Light Container",[],t);let i=t.metadata?.clusteredLight;return i&&(i.lights.length>0&&(e.horizontalTiles=i.horizontalTiles,e.verticalTiles=i.verticalTiles,e.depthSlices=i.depthSlices,e.maxRange=i.maxRange),i.lights.forEach(o=>{let r=t.getLightById(o);r&&e?.addLight(r)})),e}a(Jr,"configureLights");var tn=require("babylonjs"),Wi=require("babylonjs"),on=require("babylonjs"),rn=require("babylonjs"),Ui=new Map;async function en(t,e){let i=t.getWaitingItemsCount();for(;!t.isDisposed&&(!t.isReady()||t.getWaitingItemsCount()>0);){await new Promise(r=>setTimeout(r,150));let o=i-t.getWaitingItemsCount();o===i&&t.textures.forEach(r=>{r.delayLoadState===Wi.Constants.DELAYLOADSTATE_NONE&&(r.delayLoadState=Wi.Constants.DELAYLOADSTATE_LOADED)}),e(o/i)}}a(en,"waitForWaitingItems");async function wa(t,e,i,o,r){i.loadingQuality=r?.quality??"high",i.loadingTexturesQuality=r?.texturesQuality??i.loadingQuality,i.loadingShadowsQuality=r?.shadowsQuality??i.loadingQuality,i.loadingLodsQuality=r?.lodsQuality??i.loadingQuality,xr(),cr(),Dr(),Fr(),Kr(),Ar(),Ur(),qr();let n=Ui.get(i)??{};if(Ui.set(i,n),i.onDisposeObservable.addOnce(()=>{Ui.delete(i)}),await(0,on.AppendSceneAsync)(`${t}${e}`,i,{pluginExtension:".babylon",onProgress:a(p=>{let s=Math.min(p.loaded/p.total*.5);r?.onProgress?.(s)},"onProgress")}),await en(i,p=>{r?.onProgress?.(.5+p*.25)}),!r?.skipAssetsPreload){let p=0;do p=await Vi(t,i,o);while(p!==0&&!i.isDisposed)}rn.SceneLoaderFlags.ForceFullSceneLoadingForIncremental&&i.meshes.forEach(p=>F(p)&&p._checkDelayState());let l=Jr(i,n.clusteredLightContainer);n.clusteredLightContainer=l,await en(i,p=>{r?.onProgress?.(.75+p*.25)}),r?.onProgress?.(1),At(i),It(i.loadingLodsQuality,i),Mt(i),qe(i),i.metadata?.rendering&&(jo(i,i.metadata.rendering),i.activeCamera&&_i(i.activeCamera,t,r?.postProcessConfiguration)),i.metadata?.physicsGravity&&i.getPhysicsEngine()?.setGravity(tn.Vector3.FromArray(i.metadata?.physicsGravity)),B(i,i,o,t),i.transformNodes.forEach(p=>{B(i,p,o,t)}),i.meshes.forEach(p=>{Ko(p),B(i,p,o,t)}),i.lights.forEach(p=>{B(i,p,o,t)}),l.lights.forEach(p=>{B(i,p,o,t)}),i.cameras.forEach(p=>{B(i,p,o,t)}),i.spriteManagers?.forEach(p=>{p.sprites.forEach(s=>{B(i,s,o,t)})}),_e(i)}a(wa,"loadScene");var nn=require("babylonjs");async function Oa(t,e,i){let o=await z(t+e),n=nn.Tools.Instantiate(o.customType).Parse(o,i,t);return n.id=o.id,n.uniqueId=o.uniqueId,n}a(Oa,"loadMaterialFromFile");function Ea(t){return Promise.all(t.materials.map(async e=>{let i=e.getBindedMeshes();await Promise.all(i.map(async o=>{Te(o)||await e.forceCompilationAsync(o,{clipPlane:!!t.clipPlane,useInstances:o.hasInstances})}))}))}a(Ea,"forceCompileAllSceneMaterials");var J=require("babylonjs");function Ue(t){if(!isNaN(parseFloat(t))&&isFinite(t))return J.Animation.ANIMATIONTYPE_FLOAT;switch(t?.getClassName?.()){case"Vector2":return J.Animation.ANIMATIONTYPE_VECTOR2;case"Vector3":return J.Animation.ANIMATIONTYPE_VECTOR3;case"Quaternion":return J.Animation.ANIMATIONTYPE_QUATERNION;case"Color3":return J.Animation.ANIMATIONTYPE_COLOR3;case"Color4":return J.Animation.ANIMATIONTYPE_COLOR4;case"Size":return J.Animation.ANIMATIONTYPE_SIZE;case"Matrix":return J.Animation.ANIMATIONTYPE_MATRIX}return null}a(Ue,"getAnimationTypeForObject");var an=require("babylonjs");function Ta(t){return function(e,i){let o=e.constructor;o._NodesFromScene??=[],o._NodesFromScene.push({propertyKey:i,nodeName:t})}}a(Ta,"nodeFromScene");function Aa(t){return function(e,i){let o=e.constructor;o._ComponentsFromScene??=[],o._ComponentsFromScene.push({propertyKey:i,componentConstructor:t})}}a(Aa,"componentFromScene");function Ia(t,e=!1){return function(i,o){let r=i.constructor;r._NodesFromDescendants??=[],r._NodesFromDescendants.push({propertyKey:o,nodeName:t,directDescendantsOnly:e})}}a(Ia,"nodeFromDescendants");function Ma(t){return function(e,i){let o=e.constructor;o._AnimationGroups??=[],o._AnimationGroups.push({animationGroupName:t,propertyKey:i})}}a(Ma,"animationGroupFromScene");function Ra(t){return function(e,i){let o=e.constructor;o._SceneAssets??=[],o._SceneAssets.push({sceneName:t,propertyKey:i})}}a(Ra,"sceneAsset");function Va(t,e){return function(i,o){let r=i.constructor;r._GuiFromAsset??=[],r._GuiFromAsset.push({propertyKey:o,pathInAssets:t,onGuiCreated:e})}}a(Va,"guiFromAsset");function Fa(t){return function(e,i){let o=e.constructor;o._SoundsFromScene??=[],o._SoundsFromScene.push({propertyKey:i,soundName:t})}}a(Fa,"soundFromScene");function Na(t,e=!1){return function(i,o){let r=i.constructor;r._ParticleSystemsFromScene??=[],r._ParticleSystemsFromScene.push({propertyKey:o,particleSystemName:t,directDescendantsOnly:e})}}a(Na,"particleSystemFromScene");function Ga(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"boolean"}})}}a(Ga,"visibleAsBoolean");function Ba(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"string"}})}}a(Ba,"visibleAsString");function za(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"number"}})}}a(za,"visibleAsNumber");function Ha(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"vector2"}})}}a(Ha,"visibleAsVector2");function ka(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"vector3"}})}}a(ka,"visibleAsVector3");function Ua(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"color3"}})}}a(Ua,"visibleAsColor3");function Wa(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"color4"}})}}a(Wa,"visibleAsColor4");function Xa(t,e,i){return function(o,r){let n=o.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...i,entityType:t,type:"entity"}})}}a(Xa,"visibleAsEntity");function $a(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"texture"}})}}a($a,"visibleAsTexture");function Ka(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"keymap"}})}}a(Ka,"visibleAsKeyMap");function ja(t,e,i){return function(o,r){let n=o.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...i,assetType:t,type:"asset"}})}}a(ja,"visibleAsAsset");function Za(t,e){return function(i,o){let r=i.constructor;r._PointerEvents??=[],r._PointerEvents.push({propertyKey:o,options:{mode:"global",...e??{}},eventTypes:Array.isArray(t)?t:[t]})}}a(Za,"onPointerEvent");function Ya(t){return function(e,i){let o=e.constructor;o._KeyboardEvents??=[],o._KeyboardEvents.push({propertyKey:i,eventTypes:Array.isArray(t)?t:[t]})}}a(Ya,"onKeyboardEvent");function qa(t){return function(e,i){let o=e.constructor;o._SpritesFromSpriteManager??=[],o._SpritesFromSpriteManager.push({propertyKey:i,spriteName:t})}}a(qa,"spriteFromSpriteManager");function Qa(t){return function(e,i){let o=e.constructor;o._AnimationsFromSprite??=[],o._AnimationsFromSprite.push({propertyKey:i,animationName:t})}}a(Qa,"animationFromSprite");var St=require("babylonjs");function hv(t,e){let i;return t===St.Animation.ANIMATIONTYPE_FLOAT?i=e.value:i=e.value.clone(),{value:i,frame:e.frame,interpolation:e.interpolation,inTangent:t===St.Animation.ANIMATIONTYPE_FLOAT?e.inTangent:e.inTangent?.clone(),outTangent:t===St.Animation.ANIMATIONTYPE_FLOAT?e.outTangent:e.outTangent?.clone()}}a(hv,"cloneKey");function yt(t,e){let i=e.split("."),o=t;for(let r=0;r<i.length;++r)o=o[i[r]];return o}a(yt,"getPropertyValue");function Xi(t,e,i){let o=null;t.onAnimationGroupPlayObservable.add(()=>{o=e.onAfterAnimationsObservable.add(()=>{i()})}),t.onAnimationGroupPauseObservable.add(()=>{o&&(e.onAfterAnimationsObservable.remove(o),o=null)}),t.onAnimationGroupEndObservable.add(()=>{o&&(e.onAfterAnimationsObservable.remove(o),o=null)})}a(Xi,"registerAfterAnimationCallback");var ee=require("babylonjs"),bt=require("babylonjs"),U=require("babylonjs");function Ja(t,e){return{name:t.name,framesPerSecond:t.framesPerSecond,outputFramesPerSecond:t.outputFramesPerSecond,tracks:t.tracks.map(i=>{let o=null,r=null;if(i.node?(o=Le(i.node,e),o||(o=e.particleSystems?.find(l=>l.id===i.node)??null)):i.defaultRenderingPipeline?o=Ie():i.volumetricLightScattering&&(o=Rt()),i.propertyPath){let l=yt(o,i.propertyPath);r=Ue(l)}let n=null;return i.sound&&(n=Le(i.sound,e)),{node:o,sound:n,propertyPath:i.propertyPath,defaultRenderingPipeline:i.defaultRenderingPipeline,volumetricLightScattering:i.volumetricLightScattering,animationGroupWeight:i.animationGroupWeight,animationGroup:i.animationGroup?e.getAnimationGroupByName(i.animationGroup):null,animationGroups:i.animationGroups,sounds:i.sounds,soundVolume:$i(i.soundVolume??[],ee.Animation.ANIMATIONTYPE_FLOAT),keyFrameEvents:i.keyFrameEvents?.map(l=>{let p={...l};switch(l.data?.type){case"set-enabled":p.data={type:"set-enabled",value:l.data.value,node:Le(l.data.node,e)};break;case"apply-impulse":p.data={type:"apply-impulse",radius:l.data.radius,mesh:e.getMeshById(l.data.mesh),force:U.Vector3.FromArray(l.data.force),contactPoint:U.Vector3.FromArray(l.data.contactPoint)};break}return p}),keyFrameAnimations:o&&r!==null&&$i(i.keyFrameAnimations??[],r)}})}}a(Ja,"parseCinematic");function k(t,e){if(t===null)return null;if(t!==void 0)switch(e){case ee.Animation.ANIMATIONTYPE_FLOAT:return t;case ee.Animation.ANIMATIONTYPE_VECTOR2:return U.Vector2.FromArray(t);case ee.Animation.ANIMATIONTYPE_VECTOR3:return U.Vector3.FromArray(t);case ee.Animation.ANIMATIONTYPE_QUATERNION:return U.Quaternion.FromArray(t);case ee.Animation.ANIMATIONTYPE_COLOR3:return bt.Color3.FromArray(t);case ee.Animation.ANIMATIONTYPE_COLOR4:return bt.Color4.FromArray(t);case ee.Animation.ANIMATIONTYPE_MATRIX:return U.Matrix.FromArray(t)}}a(k,"parseCinematicKeyValue");function $i(t,e){return t?.map(i=>{let o=i.type==="key"?i:null;if(o)return{...o,value:k(o.value,e),inTangent:k(o.inTangent,e),outTangent:k(o.outTangent,e)};let r=i.type==="cut"?i:null;if(r)return{...r,key1:{...r.key1,value:k(r.key1.value,e),inTangent:k(r.key1.inTangent,e),outTangent:k(r.key1.outTangent,e)},key2:{...r.key2,value:k(r.key2.value,e),inTangent:k(r.key2.inTangent,e),outTangent:k(r.key2.outTangent,e)}};throw new Error(`Unknown key frame type: ${i.type}`)})}a($i,"parseKeyFrameAnimations");function sn(t,e){t.onEventObservable.notifyObservers(e.eventName)}a(sn,"handleApplyEvent");function ln(t){t.node?.setEnabled(t.value)}a(ln,"handleSetEnabledEvent");var Ki=require("babylonjs"),cn=Ki.Vector3.Zero();function pn(t,e){let i=e.mesh?[e.mesh]:t.meshes.filter(o=>o.physicsAggregate);e.radius&&(i=i.filter(o=>{let r=o.getBoundingInfo().boundingBox.centerWorld;return Ki.Vector3.Distance(r,e.contactPoint)<=e.radius})),i.forEach(o=>{if(o.physicsAggregate?.body){let r=e.contactPoint.subtract(o.getBoundingInfo().boundingBox.centerWorld);r.multiplyInPlace(e.force),o.physicsAggregate.body.setLinearVelocity(cn),o.physicsAggregate.body.setAngularVelocity(cn),o.physicsAggregate.body.applyImpulse(r.negateInPlace(),e.contactPoint)}})}a(pn,"handleApplyImpulseEvent");var mn=require("babylonjs"),hn=require("babylonjs"),We=class extends hn.AnimationGroup{static{a(this,"Cinematic")}onEventObservable=new mn.Observable;onEvent(e,i){this.onEventObservable.add(o=>{e===o&&i()})}};function ji(t){return t.type==="key"}a(ji,"isCinematicKey");function Oe(t){return t.type==="cut"}a(Oe,"isCinematicKeyCut");function es(t){return t.type==="event"}a(es,"isCinematicKeyEvent");function ts(t){return t.type==="group"}a(ts,"isCinematicGroup");function is(t){return t.type==="sound"}a(is,"isCinematicSound");var O=require("babylonjs"),Ee=require("babylonjs");function os(t,e,i){let o=new We(t.name,e);return t.tracks.forEach(r=>{let n=r.animationGroup;if(n&&r.animationGroups?.length){let d=n.clone(`${n.name}-cinematic-temp`),f=e.animationGroups.indexOf(d);f!==-1&&e.animationGroups.splice(f,1),o.onAnimationEndObservable.add(()=>{n.stop(),d.stop()});let S=r.animationGroups.reduce((_,x)=>Math.min(_,x.frame),Number.MAX_VALUE)??0,g=r.animationGroups.reduce((_,x)=>Math.max(_,x.frame+x.endFrame),0)??0,b={frame:S},L=new O.Animation(d.name,"frame",60,O.Animation.ANIMATIONTYPE_FLOAT,O.Animation.ANIMATIONLOOPMODE_CYCLE,!1);if(L.setKeys([{frame:S,value:0},{frame:g,value:g}]),r.animationGroups.forEach(_=>{L.addEvent(new Ee.AnimationEvent(_.frame,()=>{let x=_.repeatCount??0;if(d.to=_.endFrame,d.speedRatio=_.speed,d.stop(),d.play(x>0),d.from!==_.startFrame&&d.goToFrame(_.startFrame),x){let R=0;d.onAnimationGroupLoopObservable.add(()=>{++R,R>x&&d.stop()})}}))}),o.addTargetedAnimation(L,b),(r.animationGroupWeight?.length??0)>=2&&r.animationGroupWeight.find(x=>Oe(x)?x.key1.value!==1||x.key2.value!==1:x.value!==1)){let x={weight:0},R=new O.Animation(`${d.name}-weights`,"weight",60,O.Animation.ANIMATIONTYPE_FLOAT,O.Animation.ANIMATIONLOOPMODE_CYCLE,!1),G=[];r.animationGroupWeight.forEach(v=>{Oe(v)?(G.push(v.key1),G.push(v.key2)):G.push(v)}),R.setKeys(G),o.addTargetedAnimation(R,x),Xi(o,e,()=>{d.weight=x.weight})}}let l=r.sound;if(!i?.ignoreSounds&&l&&l.sound?.buffer&&r.sounds?.length){let d={dummy:0,volume:0},f=new O.Animation(l.name,"dummy",60,O.Animation.ANIMATIONTYPE_FLOAT,O.Animation.ANIMATIONLOOPMODE_CYCLE,!1),S=0;if(r.sounds?.forEach(g=>{let b=g.endFrame-g.startFrame;S=Math.max(S,g.frame+b),f.addEvent(new Ee.AnimationEvent(g.frame,L=>{let x=(L-g.frame+g.startFrame)/t.framesPerSecond;l.play({startOffset:x})},!1)),f.addEvent(new Ee.AnimationEvent(g.frame+b,()=>{l.stop()}))}),f.setKeys([{frame:0,value:0},{frame:S,value:S}]),o.addTargetedAnimation(f,d),(r.soundVolume?.length??0)>=2){let g=new O.Animation(l.name,"volume",60,O.Animation.ANIMATIONTYPE_FLOAT,O.Animation.ANIMATIONLOOPMODE_CYCLE,!1),b=[];r.soundVolume.forEach(L=>{Oe(L)?(b.push(L.key1),b.push(L.key2)):b.push(L)}),g.setKeys(b),o.addTargetedAnimation(g,d),Xi(o,e,()=>{l.volume=d.volume})}}if(r.keyFrameEvents){let d={dummy:0},f=new O.Animation("events","dummy",60,O.Animation.ANIMATIONTYPE_FLOAT,O.Animation.ANIMATIONLOOPMODE_CYCLE,!1),S=0;r.keyFrameEvents?.forEach(g=>{S=Math.max(S,g.frame),f.addEvent(new Ee.AnimationEvent(g.frame,()=>{switch(g.data?.type){case"event":sn(o,g.data);break;case"set-enabled":ln(g.data);break;case"apply-impulse":pn(e,g.data);break}}))}),f.setKeys([{frame:0,value:0},{frame:S+1,value:S+1}]),o.addTargetedAnimation(f,d)}let p=r.defaultRenderingPipeline?Ie():r.node;if(!p||!r.propertyPath||!r.keyFrameAnimations)return;let s=yt(p,r.propertyPath),c=Ue(s);if(c===null)return;let m=new O.Animation(r.propertyPath,r.propertyPath,60,c,O.Animation.ANIMATIONLOOPMODE_CYCLE,!1),h=[];r.keyFrameAnimations?.forEach(d=>{if(ji(d))return h.push(d);Oe(d)&&(h.push(d.key1),h.push(d.key2),Ze(p)&&r.propertyPath==="position"&&m.addEvent(new Ee.AnimationEvent(d.key1.frame,()=>{let f=Kt();if(!f)return;let S=f.motionStrength;f.motionStrength=0,requestAnimationFrame(()=>{f.motionStrength=S})})))}),m.setKeys(h),o.addTargetedAnimation(m,p)}),o.normalize(),o}a(os,"generateCinematicAnimationGroup");async function Zi(t,e){return new Promise((i,o)=>{let r=indexedDB.open(t,1);r.addEventListener("error",()=>o()),r.addEventListener("blocked",()=>o()),r.addEventListener("upgradeneeded",()=>{try{e(r.result)}catch(n){o(n)}}),r.addEventListener("success",()=>{i(r.result)})})}a(Zi,"openIndexDB");function Xe(t,e,i){return new Promise(o=>{let n=t.transaction(e).objectStore(e).get(i);n.addEventListener("error",()=>{o(null)}),n.addEventListener("success",()=>{o(n.result??null)})})}a(Xe,"getFromIndexDB");async function W(t,e,i){let r=t.transaction(e,"readwrite").objectStore(e).put(i);await new Promise((n,l)=>{r.addEventListener("error",()=>l()),r.addEventListener("success",()=>n())})}a(W,"putInIndexDB");var dn=require("babylonjs");function rs(t){dn.AbstractEngine.OfflineProviderFactory=(e,i,o=!1)=>new $e(t,e,i,o)}a(rs,"setupOfflineProvider");async function Yi(t,e){let i=await new Promise(o=>{let r=new $e(t,e,n=>o(n?r:null),!1)});return await i?.open(),i}a(Yi,"createAndOpenDatabase");var $e=class{static{a(this,"Database")}enableSceneOffline=!0;enableTexturesOffline=!0;name;_database=null;_manifestVersion=null;_loadFilePromises=new Map;constructor(e,i,o,r){this.name=e,r?o(!1):this._checkManifest(i,o)}async _checkManifest(e,i){try{let o=await z(`${e}.manifest?${Date.now()}`);this._manifestVersion=o.version,i(!0)}catch{this.enableSceneOffline=!1,this.enableTexturesOffline=!1,i(!1)}}async open(e,i){try{this._database=await Zi(this.name,o=>{o.createObjectStore("files",{keyPath:"url"}),o.createObjectStore("images",{keyPath:"url"}),o.createObjectStore("versions",{keyPath:"url"})}),e?.()}catch{i?.()}}close(){this._database?.close(),this._database=null,this._loadFilePromises.clear()}async loadImage(e,i){if(!this._database){i.src=e;return}let o=null;await Ei(()=>this._manifestVersion!==null);let r=this._loadFilePromises.get(e);if(r)return r.then(l=>{l!==null?i.src=l:i.src=e});let n=new Promise(async l=>{if(await this._getFileVersionForUrl(e)!==this._manifestVersion?(o=await Ce(e,"blob"),await Promise.all([W(this._database,"images",{url:e,data:o}),W(this._database,"versions",{url:e,version:this._manifestVersion})])):o=(await Xe(this._database,"images",e))?.data??null,o!==null){let s=URL.createObjectURL(o);i.src=s}else i.src=e;l(i.src)});this._loadFilePromises.set(e,n)}async saveImage(e){if(!this._database)throw new Error("Database is not available");let i=await Ce(e,"blob");await Promise.all([W(this._database,"images",{url:e,data:i}),W(this._database,"versions",{url:e,version:this._manifestVersion})])}async isFileMatchingVersion(e){return await this._getFileVersionForUrl(e)===this._manifestVersion}async loadFile(e,i,o,r,n){if(!this._database)return r?.();let l=null;await Ei(()=>this._manifestVersion!==null);let p=this._loadFilePromises.get(e);if(p)return p.then(c=>{c!==null?i(c):r?.()});let s=new Promise(async c=>{await this._getFileVersionForUrl(e)!==this._manifestVersion?(l=await Ce(e,n?"arraybuffer":"text",o),await Promise.all([W(this._database,"files",{url:e,data:l}),W(this._database,"versions",{url:e,version:this._manifestVersion})])):l=(await Xe(this._database,"files",e))?.data??null,l!==null?i(l):r?.(),c(l)});this._loadFilePromises.set(e,s)}async saveFile(e,i,o){if(!this._database)throw new Error("Database is not available");let r=await Ce(e,i?"arraybuffer":"text",o);await Promise.all([W(this._database,"files",{url:e,data:r}),W(this._database,"versions",{url:e,version:this._manifestVersion})])}async _getFileVersionForUrl(e){return(await Xe(this._database,"versions",e))?.version??null}};var fn=["mp3","wav"],un=["babylonbinarymeshdata"],ns=["ktx","ktx2","jpg","jpeg","png","bmp","webp"],gn=["babylon","json"],qi=["jpg","jpeg","png","bmp","webp"],vn=["bin","ktx","ktx2",...un,...fn],as=[...gn,...qi,...vn];async function ss(t,e,i){let o=[],r=await z(`${e}scenes-used-files.json`),n=[];if(i?.scenesFilter){n=i.scenesFilter.map(h=>typeof h=="string"?{sceneName:h,disableSounds:!1,disableTextures:!1,disableGeometries:!1}:h);for(let[h,d]of Object.entries(r))n.find(f=>f.sceneName===h)||delete r[h]}let l=0,p=0,s=i?.engine?.textureFormatInUse?i?.engine?.texturesSupported[0]:null,c=Object.values(r).reduce((h,d)=>h+d.length,0);function m(h){++p,i?.onProgress?.(p/c),h?.()}a(m,"notifyProgress");for(let[h,d]of Object.entries(r)){let f=h.replace(".scene",".babylon"),S=await Yi(t,`${e}${f}`);if(!S)continue;let g=n.find(b=>b.sceneName===h);for(let b=0,L=d.length;b<L;++b){let _=d[b],x=_.split(".").pop()?.toLowerCase();if(!x){m();continue}if(un.includes(x)&&g?.disableGeometries){m();continue}if(ns.includes(x)&&g?.disableTextures){m();continue}if(fn.includes(x)&&g?.disableSounds){m();continue}if(qi.includes(x)&&g?.disableTextures){m();continue}if(x==="ktx")if(s){if(!_.endsWith(s)){m();continue}}else{m();continue}if(x==="ktx2"&&!ke()){m();continue}if(o.length>300){try{await Promise.all(o)}catch{}o.splice(0,o.length)}let R=`${e}${_}`;as.includes(x)&&o.push(new Promise(async G=>{if(await S.isFileMatchingVersion(R))return m(G);try{qi.includes(x)?i?.disableImages||(await S.saveImage(R),++l):vn.includes(x)?(await S.saveFile(R,!0),++l):gn.includes(x)&&(await S.saveFile(R,!1),++l)}catch{}m(G)}))}await Promise.all(o),S.close()}return await Promise.all(o),{loadedCount:l,processedFilesCount:p}}a(ss,"preloadAssetsToDatabase");0&&(module.exports={AdvancedAssetContainer,AdvancedAssetContainerInstantiatedEntries,Cinematic,Database,NodeParticleSystemSet,VolumetricDebugMode,VolumetricDepthSource,VolumetricDitherMode,VolumetricFogMode,VolumetricLightingRenderingPipeline,VolumetricShadowKind,VolumetricShadowMode,VolumetricStepDistribution,VolumetricTransmittanceMode,_applyScriptsForObject,_getKtx2TextureName,_preloadScriptsAssets,_registerScriptInstance,_removeRegisteredScriptInstance,addExcludedCompressedTexture,animationFromSprite,animationGroupFromScene,applyMeshesLODQuality,applyRagdollJointLimits,applyRenderingConfigurationForCamera,applyScriptOnObject,applyShadowsQuality,applyTexturesQuality,canUseHdr,componentFromScene,computeVolumetricBudget,computeVolumetricShapeKey,configureEngineToUseCompressedTextures,configureMeshDistanceOrScreenCoverage,configureShadowMapRefreshRate,configureShadowMapRenderListPredicate,copyAndParseRagdollConfiguration,createAndOpenDatabase,createDefaultRenderingPipeline,createMotionBlurPostProcess,createSSAO2RenderingPipeline,createSSRRenderingPipeline,createTAARenderingPipeline,createVLSPostProcess,createVolumetricLightingPrePassConfiguration,createVolumetricLightingRenderingPipeline,defaultPipelineCameraConfigurations,disposeDefaultRenderingPipeline,disposeMotionBlurPostProcess,disposeSSAO2RenderingPipeline,disposeSSRRenderingPipeline,disposeTAARenderingPipeline,disposeVLSPostProcess,disposeVolumetricLightingRenderingPipeline,ensureVolumetricLightConfiguration,forceCompileAllSceneMaterials,generateCinematicAnimationGroup,getAllScriptsByClassForObject,getAllVolumetricCandidateLights,getAnimationTypeForObject,getDefaultRenderingPipeline,getDefaultVolumetricLightConfiguration,getDefaultVolumetricLightingConfiguration,getFromIndexDB,getHdrTextureType,getMotionBlurPostProcess,getPowerOfTwoUntil,getSSAO2RenderingPipeline,getSSRRenderingPipeline,getScriptByClassForObject,getTAARenderingPipeline,getTextureUrl,getVLSPostProcess,getVolumetricGeometryBufferDepthTexture,getVolumetricGeometryBufferRenderer,getVolumetricLightConfiguration,getVolumetricLightRange,getVolumetricLightSteps,getVolumetricLightWorldDirection,getVolumetricLightWorldPosition,getVolumetricLightingRenderingPipeline,getVolumetricPrePassDepthTexture,getVolumetricPrePassRenderer,guiFromAsset,isAbstractMesh,isAnyParticleSystem,isArcRotateCamera,isBone,isCamera,isCascadedShadowGenerator,isCinematicGroup,isCinematicKey,isCinematicKeyCut,isCinematicKeyEvent,isCinematicSound,isClusteredLightContainer,isDecalMesh,isDirectionalLight,isFreeCamera,isGPUParticleSystem,isGaussianSplattingMesh,isGroundMesh,isHemisphericLight,isInstancedMesh,isLight,isMesh,isNode,isNodeFromStaticGroup,isParticleSystem,isPointLight,isScene,isShadowGenerator,isSoundNode,isSpotLight,isSprite,isTexture,isTransformNode,isUsingKtx2CompressedTextures,isVolumetricLightEnabled,isVolumetricLightSupported,isVolumetricLightingSupported,loadMaterialFromFile,loadScene,markVolumetricLightsDirty,maxVolumetricArrayLights,maxVolumetricDirectionalLights,maxVolumetricShadowSlots,motionBlurPostProcessCameraConfigurations,nodeFromDescendants,nodeFromScene,normalizeAtlasJson,normalizeVolumetricLightConfiguration,normalizeVolumetricLightingConfiguration,onKeyboardEvent,onPointerEvent,openIndexDB,parseCinematic,parseCinematicKeyValue,parseDefaultRenderingPipeline,parseKeyFrameAnimations,parseMotionBlurPostProcess,parseRagdollConfiguration,parseSSAO2RenderingPipeline,parseSSRRenderingPipeline,parseTAARenderingPipeline,parseVLSPostProcess,parseVolumetricLightingRenderingPipeline,particleSystemFromScene,playSpriteAnimationFromName,preloadAssetsToDatabase,putInIndexDB,registerScriptAssetParser,resolveVolumetricDepthSource,resolveVolumetricShadowSlot,saveRenderingConfigurationForCamera,sceneAsset,scriptAssetsCache,scriptAssetsParsers,scriptsDictionary,selectVolumetricLights,serializeDefaultRenderingPipeline,serializeMotionBlurPostProcess,serializeSSAO2RenderingPipeline,serializeSSRRenderingPipeline,serializeTAARenderingPipeline,serializeVLSPostProcess,serializeVolumetricLightingRenderingPipeline,setDefaultRenderingPipelineRef,setMotionBlurPostProcessRef,setSSAO2RenderingPipelineRef,setSSRRenderingPipelineRef,setStaticDecalsEnabled,setTAARenderingPipelineRef,setUseKtx2CompressedTextures,setVLSPostProcessRef,setVolumetricLightingRenderingPipelineRef,setupOfflineProvider,soundFromScene,spriteFromSpriteManager,ssaoRenderingPipelineCameraConfigurations,ssrRenderingPipelineCameraConfigurations,supportsVolumetricFloatDepthTexture,taaRenderingPipelineCameraConfigurations,visibleAsAsset,visibleAsBoolean,visibleAsColor3,visibleAsColor4,visibleAsEntity,visibleAsKeyMap,visibleAsNumber,visibleAsString,visibleAsTexture,visibleAsVector2,visibleAsVector3,vlsPostProcessCameraConfigurations,volumetricLightMetadataKey,volumetricLightingPrePassConfigurationName,volumetricLightingRenderingPipelineCameraConfigurations});
2342
+ `),i}_createPostProcess(e){let i=new Uo.PostProcess(e.name,e.shaderName,e.uniforms,e.samplers,e.ratio,null,e.samplingMode,this._scene.getEngine(),!1,e.defines,e.textureType,void 0,void 0,!1,e.textureFormat,this._shaderLanguage);return i.autoClear=!1,i.alphaMode=Z.Constants.ALPHA_DISABLE,i}_buildRenderEffects(){let e=this._scene.getEngine(),i=this._configuration,o=this._getEnvironment();this._linearDepthDefines=this._buildLinearDepthDefines(o),this._scatteringDefines=this._buildScatteringDefines(this._selection,o),this._blurDefines=this._buildBlurDefines(o),this._composeDefines=this._buildComposeDefines(o),this._linearDepthPostProcess=this._createPostProcess({name:"VolumetricLightingLinearDepth",shaderName:nt,uniforms:["volCameraMinMaxZ","volDepthUnpack"],samplers:["depthSampler"],ratio:1,samplingMode:Fe.Texture.BILINEAR_SAMPLINGMODE,textureType:this._textureType,defines:this._linearDepthDefines}),this._linearDepthPostProcess.onApplyObservable.add(r=>this._bindLinearDepth(r)),this._applyPrePassConfiguration(),this._scatteringPostProcess=this._createPostProcess({name:"VolumetricLightingScattering",shaderName:at,uniforms:pa,samplers:zo,ratio:1,samplingMode:Fe.Texture.NEAREST_SAMPLINGMODE,textureType:this._linearDepthPacked?Z.Constants.TEXTURETYPE_UNSIGNED_BYTE:Z.Constants.TEXTURETYPE_FLOAT,textureFormat:this._linearDepthPacked?Z.Constants.TEXTUREFORMAT_RGBA:Z.Constants.TEXTUREFORMAT_R,defines:this._scatteringDefines}),this._scatteringPostProcess.onApplyObservable.add(r=>this._bindScattering(r)),this._blurPostProcesses=[];for(let r=0;r<i.blurPasses;++r){let n=this._createPostProcess({name:`VolumetricLightingBlur${r}`,shaderName:st,uniforms:["volCameraMinMaxZ","volDepthRatio","volBlurDirection","volBlurParams"],samplers:["volLinearDepthSampler"],ratio:i.resolutionScale,samplingMode:Fe.Texture.BILINEAR_SAMPLINGMODE,textureType:this._textureType,defines:this._blurDefines});n.onApplyObservable.add(l=>this._bindBlur(l,r)),this._blurPostProcesses.push(n)}this._composePostProcess=this._createPostProcess({name:"VolumetricLightingCompose",shaderName:lt,uniforms:["volCameraMinMaxZ","volDepthRatio","volComposeParams"],samplers:["volSceneSampler","volLinearDepthSampler"],ratio:i.resolutionScale,samplingMode:Fe.Texture.BILINEAR_SAMPLINGMODE,textureType:this._textureType,defines:this._composeDefines}),this._composePostProcess.onApplyObservable.add(r=>this._bindCompose(r)),this.addEffect(new Ne.PostProcessRenderEffect(e,t.SceneColorEffectName,()=>this._linearDepthPostProcess,!0)),this.addEffect(new Ne.PostProcessRenderEffect(e,t.ScatteringEffectName,()=>this._scatteringPostProcess,!0)),this._blurPostProcesses.length&&this.addEffect(new Ne.PostProcessRenderEffect(e,t.BlurEffectName,()=>this._blurPostProcesses,!0)),this.addEffect(new Ne.PostProcessRenderEffect(e,t.ComposeEffectName,()=>this._composePostProcess,!0)),this._applyMsaaSamples()}_disposePostProcesses(e){[this._linearDepthPostProcess,this._scatteringPostProcess,...this._blurPostProcesses,this._composePostProcess].forEach(o=>{o&&(e.forEach(r=>o.dispose(r)),o.dispose())}),this._linearDepthPostProcess=null,this._scatteringPostProcess=null,this._blurPostProcesses=[],this._composePostProcess=null}_rebuildRenderEffects(){if(this._disposed)return;let e=this._scene.postProcessRenderPipelineManager,i=this._cameras.slice();try{e.detachCamerasFromRenderPipeline(this.name,i),this._disposePostProcesses(i),Object.keys(this._renderEffects).forEach(o=>{delete this._renderEffects[o]}),this._buildRenderEffects()}catch(o){console.error("Failed to rebuild the volumetric lighting rendering pipeline.",o)}finally{try{e.attachCamerasToRenderPipeline(this.name,i)}catch(o){console.error("Failed to re-attach the cameras to the volumetric lighting rendering pipeline.",o)}}this._lightsDirty=!0}_updateSelection(){if(this._disposed||!this._scatteringPostProcess||(++this._frameCount,!(this._lightsDirty||!this._selection||this._frameCount%this._configuration.selectionRefreshRate===0)))return;this._lightsDirty=!1;let i=this._getEnvironment(),o=di(this._scene,this._camera,this._configuration,this._budget,this._selection);this._selection=o;let r=this._buildScatteringDefines(o,i);r!==this._scatteringDefines&&(this._scatteringDefines=r,this._scatteringPostProcess.updateEffect(r));let n=this._buildLinearDepthDefines(i);n!==this._linearDepthDefines&&(this._linearDepthDefines=n,this._linearDepthPostProcess?.updateEffect(n));let l=this._buildBlurDefines(i);l!==this._blurDefines&&(this._blurDefines=l,this._blurPostProcesses.forEach(s=>s.updateEffect(l)));let p=this._buildComposeDefines(i);p!==this._composeDefines&&(this._composeDefines=p,this._composePostProcess?.updateEffect(p))}_writeLight(e,i,o,r,n,l){let{light:p,config:s}=e,c=i*4;te(p)?(Re(p,this._temporaryVector),o[c]=-this._temporaryVector.x,o[c+1]=-this._temporaryVector.y,o[c+2]=-this._temporaryVector.z,o[c+3]=1):(et(p,this._temporaryVector).subtractInPlace(this._camera.globalPosition),o[c]=this._temporaryVector.x,o[c+1]=this._temporaryVector.y,o[c+2]=this._temporaryVector.z,o[c+3]=re(p)?2:0),s.useCustomColor?this._temporaryColor.set(s.color[0],s.color[1],s.color[2]):this._temporaryColor.copyFrom(p.diffuse);let m=p.getScaledIntensity()*s.volumeIntensity*1e-5;r[c]=this._temporaryColor.r*m,r[c+1]=this._temporaryColor.g*m,r[c+2]=this._temporaryColor.b*m,r[c+3]=s.anisotropy,re(p)?(Re(p,this._temporaryVector),n[c]=this._temporaryVector.x,n[c+1]=this._temporaryVector.y,n[c+2]=this._temporaryVector.z,n[c+3]=Math.cos(p.angle*.5),l[c+1]=p.exponent):(n[c]=0,n[c+1]=0,n[c+2]=1,n[c+3]=-1,l[c+1]=1),l[c]=tt(p,s,this._configuration),l[c+2]=s.castVolumetricShadows?1:0,l[c+3]=s.shadowDarkness}_bindLinearDepth(e){let i=null;switch(this._depthSource){case 2:{let o=ye(this._scene);i=o?vi(o):null;break}case 1:{let o=Ve(this._scene);i=o?Si(o):null;break}default:i=this._depthRenderer?.getDepthMap()??null;break}i&&(e.setTexture("depthSampler",i),this._bindDepthUniforms(e))}_bindScattering(e){let i=this._scene,o=this._camera,r=this._configuration,n=this._selection;if(!n)return;this._inverseViewProjection.copyFrom(i.getTransformMatrix()),this._inverseViewProjection.invert(),e.setMatrix("volInverseViewProjection",this._inverseViewProjection),e.setVector3("volCameraPosition",o.globalPosition),o.getDirectionToRef(i.useRightHandedSystem?la:sa,this._temporaryVector),e.setVector3("volCameraForward",this._temporaryVector.normalize()),e.setFloat2("volCameraMinMaxZ",o.minZ,o.maxZ),e.setFloat("volFrameIndex",i.getRenderId()%64),this._bindDepthRatio(e),e.setFloat4("volFogInfos",r.fogMode,r.fogStart,r.fogEnd,r.fogDensity),this._temporaryColor.set(r.fogColor[0],r.fogColor[1],r.fogColor[2]),e.setColor3("volFogColor",this._temporaryColor),e.setFloat("volLinearFogEps",Math.max((r.fogEnd-r.fogStart)*.02,1e-4)),e.setFloat4("volMedium",r.albedo,r.heightFogBaseHeight,r.heightFogFalloff,0),r.screenSpaceShadows&&(e.setMatrix("volViewProjection",i.getTransformMatrix()),e.setFloat4("volScreenShadowParams",r.screenSpaceShadowMaxDistance,r.screenSpaceShadowBias,r.screenSpaceShadowThickness,0)),this._temporaryColor.set(r.ambientColor[0],r.ambientColor[1],r.ambientColor[2]).scaleInPlace(r.ambientIntensity),e.setColor3("volAmbient",this._temporaryColor);let l=n.unshadowed.length,p=l-n.directionalCount;e.setFloat4("volParams",r.maxDistance,r.ditherStrength,r.lightExtinctionClamp,p);for(let s=0;s<l;++s)this._writeLight(n.unshadowed[s],s,this._lightData,this._lightDiffuse,this._lightDirection,this._lightFalloff);if(l){let s=l*4;e.setFloatArray4("volLightData",this._lightData.subarray(0,s)),e.setFloatArray4("volLightDiffuse",this._lightDiffuse.subarray(0,s)),e.setFloatArray4("volLightDirection",this._lightDirection.subarray(0,s)),e.setFloatArray4("volLightFalloff",this._lightFalloff.subarray(0,s))}if(n.shadowed.forEach((s,c)=>{this._writeLight(s.candidate,c,this._shadowLightData,this._shadowLightDiffuse,this._shadowLightDirection,this._shadowLightFalloff);let{generator:m,kind:h,mode:d,mapSize:f}=s.shadow,S=s.candidate.light,u=c*4;this._shadowLightFalloff[u+2]=m.frustumEdgeFalloff;let y=S.getDepthMinZ?.(i.activeCamera)??0,L=S.getDepthMaxZ?.(i.activeCamera)??1;this._shadowInfo[u]=m.getDarkness(),this._shadowInfo[u+1]=h===1?1/f:d===0?0:m.depthScale,this._shadowInfo[u+2]=y,this._shadowInfo[u+3]=y+L,m.getTransformMatrix().copyToArray(this._shadowMatrices,c*16);let _=m.getShadowMapForRendering();h===1?e.setDepthStencilTexture(`volShadowSampler${c}`,_):e.setTexture(`volShadowSampler${c}`,_)}),n.shadowed.length){let s=n.shadowed.length*4;e.setFloatArray4("volShadowLightData",this._shadowLightData.subarray(0,s)),e.setFloatArray4("volShadowLightDiffuse",this._shadowLightDiffuse.subarray(0,s)),e.setFloatArray4("volShadowLightDirection",this._shadowLightDirection.subarray(0,s)),e.setFloatArray4("volShadowLightFalloff",this._shadowLightFalloff.subarray(0,s)),e.setFloatArray4("volShadowInfo",this._shadowInfo.subarray(0,s)),e.setMatrices("volShadowMatrix",this._shadowMatrices.subarray(0,n.shadowed.length*16))}if(n.csm){let{candidate:s,generator:c,cascades:m,kind:h}=n.csm,d=s.light;this._writeLight(s,0,this._csmLightData,this._csmLightDiffuse,this._csmLightDirection,this._csmLightFalloff),e.setFloat4("volCsmLightData",this._csmLightData[0],this._csmLightData[1],this._csmLightData[2],this._csmLightData[3]),e.setFloat4("volCsmLightDiffuse",this._csmLightDiffuse[0],this._csmLightDiffuse[1],this._csmLightDiffuse[2],this._csmLightDiffuse[3]),e.setFloat4("volCsmLightDirection",this._csmLightDirection[0],this._csmLightDirection[1],this._csmLightDirection[2],this._csmLightDirection[3]),e.setFloat4("volCsmLightFalloff",this._csmLightFalloff[0],this._csmLightFalloff[1],c.frustumEdgeFalloff,s.config.shadowDarkness);let f=d.getDepthMinZ?.(i.activeCamera)??1,S=d.getDepthMaxZ?.(i.activeCamera)??1,u=c.getShadowMap()?.getSize().width??1024;e.setFloat4("volCsmInfo",c.getDarkness(),1/u,f,f+S);for(let L=0;L<m;++L)c.getCascadeTransformMatrix(L)?.copyToArray(this._csmMatrices,L*16);e.setMatrices("volCsmMatrices",this._csmMatrices.subarray(0,m*16));let y=c.getShadowMapForRendering();h===1?e.setDepthStencilTexture("volCsmSampler",y):e.setTexture("volCsmSampler",y)}}_bindDepthRatio(e){let i=this._scatteringPostProcess,o=this._blurPostProcesses[0]??this._composePostProcess,r=i&&i.width>0?i.width:1,n=i&&i.height>0?i.height:1,l=o&&o.width>0?o.width:r,p=o&&o.height>0?o.height:n;e.setFloat2("volDepthRatio",r/l,n/p)}_bindBlur(e,i){this._scatteringPostProcess&&(e.setTextureFromPostProcess("volLinearDepthSampler",this._scatteringPostProcess),e.setFloat2("volCameraMinMaxZ",this._camera.minZ,this._camera.maxZ),this._bindDepthRatio(e),e.setFloat2("volBlurDirection",i%2===0?1:0,i%2===0?0:1),e.setFloat2("volBlurParams",Math.max(this._configuration.blurRadius*.5,.5),this._configuration.blurDepthThreshold))}_bindCompose(e){if(!this._linearDepthPostProcess||!this._scatteringPostProcess)return;let i=this._configuration;e.setTextureFromPostProcess("volSceneSampler",this._linearDepthPostProcess),e.setTextureFromPostProcess("volLinearDepthSampler",this._scatteringPostProcess),e.setFloat2("volCameraMinMaxZ",this._camera.minZ,this._camera.maxZ),this._bindDepthRatio(e);let o=this._ldrEncode?1/255:0;e.setFloat4("volComposeParams",i.intensity,i.extinctionAmount,i.upsampleDepthThreshold,o)}};var I=null,xe=new Map;function ma(){return I?.isDisposed&&(I=null),I}a(ma,"getVolumetricLightingRenderingPipeline");function ha(t){I=t}a(ha,"setVolumetricLightingRenderingPipelineRef");function da(t){let e=t?.getEngine();return e?Y.IsSupported(e):!1}a(da,"isVolumetricLightingSupported");function Ci(){I&&(I.dispose(),I=null)}a(Ci,"disposeVolumetricLightingRenderingPipeline");function Xo(t,e,i){return I=new Y("VolumetricLightingRenderingPipeline",t,e),I.msaaSamples=i?.msaaSamples??1,I}a(Xo,"createVolumetricLightingRenderingPipeline");function Li(){return I?I.serializeConfiguration():null}a(Li,"serializeVolumetricLightingRenderingPipeline");function Di(t,e,i,o){let r=I??Xo(t,e,o);r.msaaSamples=o?.msaaSamples??1;let n={...i};return n.fogDensity===void 0&&(n.fogDensity=Y.GetDefaultFogDensity(r.scene,r.camera)),n.fogEnd===void 0&&(n.fogEnd=Y.GetDefaultFogEnd(r.scene,r.camera)),n.screenSpaceShadowMaxDistance===void 0&&(n.screenSpaceShadowMaxDistance=Y.GetDefaultFogEnd(r.scene,r.camera)),r.applyConfiguration(Se(n)),r}a(Di,"parseVolumetricLightingRenderingPipeline");function fa(){I?.markLightsDirty()}a(fa,"markVolumetricLightsDirty");var ct=require("babylonjs");function ua(t){ue.set(t,Xt()),he.set(t,Ft()),de.set(t,Bt()),ge.set(t,Zt()),xe.set(t,Li()),ve.set(t,Jt()),fe.set(t,kt())}a(ua,"saveRenderingConfigurationForCamera");function _i(t,e,i){Wt(),Vt(t.getScene()),Gt(),jt(),Ci(),Qt(),Ht();let o=ue.get(t);o&&!i?.ssao2Disabled&&$t(t.getScene(),t,o,i);let r=xe.get(t);r&&!i?.volumetricLightingDisabled&&Di(t.getScene(),t,r,i);let n=he.get(t);n&&!i?.vlsDisabled&&Nt(t.getScene(),n,i);let l=de.get(t);l&&!i?.ssrDisabled&&zt(t.getScene(),t,l,i);let p=ge.get(t);p&&!i?.motionBlurDisabled&&Yt(t.getScene(),t,p,i);let s=ve.get(t);s&&!i?.defaultPipelineDisabled&&ei(t.getScene(),t,s,e,i);let c=fe.get(t);c&&!i?.taaDisabled&&Ut(t.getScene(),t,c,i)}a(_i,"applyRenderingConfigurationForCamera");function ga(t){let e=t.getCaps();return e.textureHalfFloatRender||e.textureFloatRender}a(ga,"canUseHdr");function X(t){let e=t.getCaps();return e.textureHalfFloatRender?ct.Constants.TEXTURETYPE_HALF_FLOAT:e.textureFloatRender?ct.Constants.TEXTURETYPE_FLOAT:ct.Constants.TEXTURETYPE_UNSIGNED_BYTE}a(X,"getHdrTextureType");var Ge=require("babylonjs"),$o=require("babylonjs");function Ko(t){let e=t.metadata?.physicsAggregate;if(!e)return;let i;V(t)?i=t:Te(t)&&(i=t.sourceMesh);let o=new $o.PhysicsAggregate(t,e.shape.type,{mesh:i,mass:e.massProperties.mass});o.body.setMassProperties({mass:e.massProperties.mass,inertia:e.massProperties.inertia?Ge.Vector3.FromArray(e.massProperties.inertia):void 0,centerOfMass:e.massProperties.centerOfMass?Ge.Vector3.FromArray(e.massProperties.centerOfMass):void 0,inertiaOrientation:e.massProperties.inertiaOrientation?Ge.Quaternion.FromArray(e.massProperties.inertiaOrientation):void 0}),o.shape.density=e.shape.density,o.body.setMotionType(e.body.motionType),o.shape.material=e.material,t.physicsAggregate=o,t.metadata.physicsAggregate=void 0}a(Ko,"configurePhysicsAggregate");function jo(t,e){(Array.isArray(e)?e:[]).forEach(o=>{let r=t.getCameraById(o.cameraId);r&&(o.ssao2RenderingPipeline&&ue.set(r,o.ssao2RenderingPipeline),o.vlsPostProcess&&he.set(r,o.vlsPostProcess),o.ssrRenderingPipeline&&de.set(r,o.ssrRenderingPipeline),o.motionBlurPostProcess&&ge.set(r,o.motionBlurPostProcess),o.volumetricLightingRenderingPipeline&&xe.set(r,o.volumetricLightingRenderingPipeline),o.defaultRenderingPipeline&&ve.set(r,o.defaultRenderingPipeline),o.taaRenderingPipeline&&fe.set(r,o.taaRenderingPipeline))})}a(jo,"applyRenderingConfigurations");var Zo=require("babylonjs");function Ce(t,e,i){return new Promise((o,r)=>{let n=new Zo.WebRequest;n.open("GET",t),n.responseType=e,n.send(),n.addEventListener("progress",l=>{i?.({total:l.total,loaded:l.loaded})}),n.addEventListener("load",()=>{o(e==="text"?n.responseText:n.response)}),n.addEventListener("error",l=>r(l))})}a(Ce,"loadFile");async function B(t,e){let i=await Ce(t,"text",e);return JSON.parse(i)}a(B,"loadJsonFile");function Pi(t,e){let i=e.getNodeByName(t);if(i)return i;let o=e.lights.filter(r=>pe(r));for(let r of o){let n=r.lights.find(l=>l.name===t);if(n)return n}return null}a(Pi,"getNodeByName");function Le(t,e){let i=e.getNodeById(t);if(i)return i;let o=e.lights.filter(r=>pe(r));for(let r of o){let n=r.lights.find(l=>l.id===t);if(n)return n}return null}a(Le,"getNodeById");var se=require("babylonjs"),Yo=require("babylonjs");function wi(t){let e=Yo.Vector3.FromArray(t);return e.equals(se.Axis.X)?se.Axis.X:e.equals(se.Axis.Y)?se.Axis.Y:e.equals(se.Axis.Z)?se.Axis.Z:e}a(wi,"parseAxis");var qo=require("babylonjs"),q=require("babylonjs");function Qo(t){return t.runtimeConfiguration.forEach(e=>{e.rotationAxis&&(e.rotationAxis=wi(e.rotationAxis)),e.boneOffsetAxis&&(e.boneOffsetAxis=wi(e.boneOffsetAxis))}),t}a(Qo,"parseRagdollConfiguration");function Oi(t){let e={rootNodeId:t.rootNodeId,skeletonName:t.skeletonName,scalingFactor:t.scalingFactor,runtimeConfiguration:t.runtimeConfiguration.map(i=>({name:i.name,bones:i.bones,width:i.width,depth:i.depth,height:i.height,size:i.size,joint:i.joint,min:i.min,max:i.max,mass:i.mass??1,boxOffset:i.boxOffset,restitution:i.restitution??0,rotationAxis:i.rotationAxis?.slice(),boneOffsetAxis:i.boneOffsetAxis?.slice()}))};return Qo(e)}a(Oi,"copyAndParseRagdollConfiguration");function va(t,e){let i=t.getConstraints(),r=t._skeleton?.getChildren()[0],n=[];if(e.forEach(p=>{(p.bone!==void 0?[p.bone]:p.bones).forEach(c=>{c!==r?.name&&n.push(p)})}),n.length!==i.length)return qo.Logger.Warn("Failed to apply the ragdoll joint limits: the constraints of the ragdoll don't match its configuration."),0;let l=0;return i.forEach((p,s)=>{let c=n[s];if((c.joint??q.PhysicsConstraintType.HINGE)!==q.PhysicsConstraintType.HINGE||c.min===void 0||c.max===void 0)return;let h=Math.min(c.min,c.max),d=Math.max(c.min,c.max),f=p._physicsPlugin;f&&(f.setAxisMode(p,q.PhysicsConstraintAxis.ANGULAR_X,q.PhysicsConstraintAxisLimitMode.LIMITED),f.setAxisMinLimit(p,q.PhysicsConstraintAxis.ANGULAR_X,h*Math.PI/180),f.setAxisMaxLimit(p,q.PhysicsConstraintAxis.ANGULAR_X,d*Math.PI/180),++l)}),l}a(va,"applyRagdollJointLimits");function Sa(t){return new Promise(e=>{setTimeout(()=>e(),t)})}a(Sa,"waitMs");async function Ei(t){for(;!t();)await Sa(150)}a(Ei,"waitUntil");function Ti(t){return t&&JSON.parse(JSON.stringify(t))}a(Ti,"cloneJSObject");var Ii=require("babylonjs"),nr=require("babylonjs"),pt=require("babylonjs"),ar=require("babylonjs"),sr=require("babylonjs"),lr=require("babylonjs"),ie=require("babylonjs"),Jo=!1,er=null,De=[],Ai=new Map;function ya(t,e){let i=(0,ie._GetAudioEngine)(null);return new lr._WebAudioStaticSound(t,i,e)}a(ya,"createSoundInstance");function tr(t){if(er?.remove(),!De.length)return;let e=Ii.Vector3.Zero();er=t.onBeforeRenderObservable.add(()=>{let i=(0,ie._GetAudioEngine)(null).listener.attachedNode;i&&(i.getWorldMatrix().getTranslationToRef(e),De.forEach(o=>{o.isEnabled(!1)&&o.autoUpdateSpatial&&o.sound?._isSpatial&&o.isPlaying()&&t.activeCamera&&Ii.Vector3.Distance(e,o.getAbsolutePosition())<=o.sound.spatial.maxDistance&&o.sound.spatial.update()}))})}a(tr,"registerUpdateSoundsObserver");function ir(t,e){e.onDisposeObservable.addOnce(()=>{let i=De.indexOf(t);i!==-1&&De.splice(i,1)})}a(ir,"registerSoundInstanceCleanup");function or(t){t.sound&&ir(t,t.sound),t.onDisposeObservable.addOnce(()=>{t.sound?.dispose()})}a(or,"registerSoundNodeEvents");function ba(t,e){return new Promise(async(i,o)=>{if(!t.offlineProvider||!nr.Database.IDBStorageEnabled)return(0,ie.CreateSoundBufferAsync)(e).then(r=>i(r)).catch(r=>o(r));t.offlineProvider.loadFile(e,r=>{(0,ie.CreateSoundBufferAsync)(r).then(n=>i(n)).catch(n=>o(n))},void 0,()=>{o(null)},!0)})}a(ba,"loadSoundBuffer");function Mi(t,e){if(!t.soundRelativePath||!t.sound)return;e.onSoundLoadedObservable=new ar.Observable;let i=ya(t.soundRelativePath,{spatialAutoUpdate:!1});i._initAsync(t.sound.buffer,{spatialAutoUpdate:!0}).then(()=>{i.volume=t.volume,i._isSpatial=t.sound._isSpatial,i._isSpatial&&(i.spatial.attach(e),i.spatial.maxDistance=t.sound.spatial.maxDistance,i.spatial.panningModel=t.sound.spatial.panningModel,i.spatial.distanceModel=t.sound.spatial.distanceModel),e.sound=i,e.soundRelativePath=t.soundRelativePath,e.autoUpdateSpatial=t.autoUpdateSpatial,De.push(e),ir(e,i),tr(e.getScene()),e.onSoundLoadedObservable.notifyObservers(e)}),or(e),rr(e,i)}a(Mi,"configureSourceNodeFrom");function rr(t,e){Object.defineProperty(t,"volume",{get:a(()=>e.volume,"get"),set:a(i=>{e.volume=i},"set")}),Object.defineProperty(t,"playbackRate",{get:a(()=>e.playbackRate,"get"),set:a(i=>{e.playbackRate=i},"set")}),t.isPaused=()=>e.state===pt.SoundState.Paused,t.isPlaying=()=>e.state===pt.SoundState.Started,t.isStopped=()=>e.state===pt.SoundState.Stopped,t.pause=()=>e.pause(),t.resume=()=>e.resume(),t.stop=i=>e.stop(i),t.play=i=>e.play(i),t.setVolume=(i,o)=>e.setVolume(i,o),t.getClassName=()=>"SoundNode",t.setSoundSpatial=i=>new Promise(o=>{e._isSpatial=i,setTimeout(()=>{i&&e.spatial.attach(t),o()})}),t.cloneAsync=async(i,o,r)=>new Promise(n=>{let l=t.clone(i,o,r);Mi(t,l),l.onSoundLoadedObservable.addOnce(()=>{setTimeout(()=>n(l))})})}a(rr,"configureSoundNodePrototype");function cr(){Jo||(Jo=!0,(0,sr.AddParser)("SoundNode",(t,e,i,o)=>{t.transformNodes?.forEach(r=>{if(!r.isSoundNode)return;let n=i.transformNodes?.find(l=>l.id===r.id);if(n&&r.soundRelativePath){let l=`${o}${r.soundRelativePath}`;e.addPendingData(l),Ai.has(l)||Ai.set(l,ba(e,l)),Ai.get(l).then(s=>{(0,ie.CreateSoundAsync)(r.soundRelativePath,s,{spatialAutoUpdate:!1}).then(c=>{if(e.removePendingData(l),n.isDisposed())return c.dispose();c.volume=r.volume,c._isSpatial=r.isSpatial,r.isSpatial&&(c.spatial.attach(n),c.spatial.maxDistance=r.maxDistance,c.spatial.panningModel=r.panningModel,c.spatial.distanceModel=r.distanceModel),n.sound=c,n.soundRelativePath=r.soundRelativePath,n.autoUpdateSpatial=r.autoUpdateSpatial,De.push(n),or(n),rr(n,c),tr(e)})})}})}))}a(cr,"registerAudioParser");var pr=require("babylonjs");function _e(t){let e=new Set;[...t.transformNodes,...t.meshes].forEach(o=>{if(o.metadata?.isStaticGroup){let r=o.getDescendants(!1);r.push(o),r.forEach(n=>{if((oe(n)||ee(n)&&!n.isWorldMatrixFrozen)&&n.billboardMode===pr.AbstractMesh.BILLBOARDMODE_NONE&&n.freezeWorldMatrix(),oe(n)){let l=n.material;l&&!l.isFrozen&&!e.has(l)&&(e.add(l),l.onBindObservable.addOnce(()=>{l.freeze()}))}})}})}a(_e,"configureTransformNodes");var Be=class{constructor(e,i){this.entries=e;this.namingId=i}entries;namingId;static{a(this,"AdvancedAssetContainerInstantiatedEntries")}get rootNodes(){return this.entries.rootNodes}get skeletons(){return this.entries.skeletons}get animationGroups(){return this.entries.animationGroups}dispose(){this.entries.dispose()}getRootNodeByName(e){let i=`${e}-${this.namingId}`;return this.entries.rootNodes.find(o=>o.name===i)??null}getNodeByName(e){let i=`${e}-${this.namingId}`;for(let o of this.entries.rootNodes){let r=this._recursivelyGetNodeByName(i,o);if(r)return r}return null}_recursivelyGetNodeByName(e,i){if(i.name===e)return i;for(let o of i.getDescendants(!0)){let r=this._recursivelyGetNodeByName(e,o);if(r)return r}return null}getScriptByClassByObjectName(e,i){let o=this.getNodeByName(e);if(o){let r=Pe(o,i);if(r?.length===1)return r[0]}return null}};var Ri=require("babylonjs"),ze=class{static{a(this,"AdvancedAssetContainer")}container;_rootUrl;_scriptsMap;_originalDescendants=[];_nodesMap=new Map;_animationGroupsMap=new Map;constructor(e,i,o){this.container=e,this._rootUrl=i,this._scriptsMap=o,e.populateRootNodes(),e.rootNodes.forEach(r=>{this._originalDescendants.push(r,...r.getDescendants(!1))}),e.animationGroups.forEach(r=>{this._animationGroupsMap.set(r.name,r)}),this._originalDescendants.forEach(r=>{this._nodesMap.set(r,{node:r,metadata:Ti(r.metadata)})})}removeDefault(){this.container.getNodes().forEach(e=>{z.get(e)?.forEach(o=>{mt(e,o)})}),this.container.removeAllFromScene()}getRootNodeByName(e){return this.container.rootNodes.find(i=>i.name===e)??null}getScriptByClassByObjectName(e,i){let o=this.container.getNodes();for(let r of o)if(r.name===e){let n=Pe(r,i);if(n?.length===1)return n[0]}return null}instantiate(e){let i=Ri.Tools.RandomId(),o=a(s=>s,"nameFunction"),r=this.container.instantiateModelsToScene(o,!1,{...e,predicate:a(s=>(s.name=`${s.name}@editor-tools@${i}_${s.id}`,e?.predicate?.(s)??!0),"predicate")}),n=new Be(r,i);[...this.container.transformNodes,...this.container.meshes,...this.container.lights,...this.container.cameras,...this.container.animationGroups,...this.container.skeletons].forEach(s=>{let c=s.name.split("@editor-tools@");s.name=c[0]}),r.animationGroups.forEach(s=>{let c=s.name.split("@editor-tools@");s.name=`${c[0]}-${i}`});let p=[];return r.rootNodes.forEach(s=>{p.push(s,...s.getDescendants(!1))}),p.forEach(s=>{let c=s.name.split("@editor-tools@"),m=c[1].split("_").pop();s.name=`${c[0]}-${i}`;let h=this._originalDescendants.find(d=>d.id===m);ne(h)&&ee(s)&&Mi(h,s),s.id=Ri.Tools.RandomId(),s.metadata=Ti(this._nodesMap.get(h).metadata),s.metadata??={},s.metadata.originalId=m,p.forEach(d=>{d.metadata.scripts?.forEach(f=>{Object.keys(f.values||{}).forEach(u=>{let y=f.values[u];if(y.type==="entity"){y.value===m&&(y.value=s.id),y.value===h.name&&(y.value=s.name);let L=this._animationGroupsMap.get(y.value);L&&(y.value=`${L.name}-${i}`)}})})})}),p.forEach(s=>{G(this.container.scene,s,this._scriptsMap,this._rootUrl)}),_e(this.container.scene),n}};var mr=require("babylonjs"),hr=require("babylonjs");async function dr(t,e,i){let o=i.iblIntensity,r=i.environmentIntensity,l=t.split("/").pop().replace(".scene",".babylon"),p=await(0,hr.LoadAssetContainerAsync)(l,i,{rootUrl:e,pluginExtension:".babylon"});return i.onDisposeObservable.addOnce(()=>{p.dispose()}),mr.SceneLoaderFlags.ForceFullSceneLoadingForIncremental&&i.meshes.forEach(s=>V(s)&&s._checkDelayState()),p.addAllToScene(),i.iblIntensity=o,i.environmentIntensity=r,_e(i),p}a(dr,"preloadSceneScriptAsset");async function fr(t,e){return B(`${e}${t}`)}a(fr,"preloadCommonScriptAsset");var le=new Map,He=new Map;function xa(t,e){He.has(t)&&console.warn(`A parser for the extension '${t}' was already registered. It will be overwritten.`),He.set(t,e)}a(xa,"registerScriptAssetParser");async function Vi(t,e,i){let o=[e,...e.transformNodes,...e.meshes,...e.lights,...e.cameras],r=le.get(e);r||(r=new Map,le.set(e,r)),e.onDisposeObservable.addOnce(()=>{le.delete(e)}),o.filter(s=>s.metadata?.scripts?.length).map(s=>s.metadata.scripts).flat().forEach(s=>{if(i[s.key]?.default?._SceneAssets?.forEach(m=>{r.get(m.sceneName)||r.set(m.sceneName,null)}),s.values)for(let m in s.values){if(!s.values.hasOwnProperty(m))continue;let h=s.values[m];h.type==="asset"&&h.value&&!r.get(h.value)&&r.set(h.value,null)}});let l=0;for(let s of r.values())s===null&&++l;if(l===0)return l;let p=[];return r.forEach((s,c)=>{r.get(c)||p.push(new Promise(async m=>{try{let h=c.split(".").pop();switch(h){case"scene":let d=await dr(c,t,e);e.onDisposeObservable.addOnce(()=>{d.dispose(),r.delete(c)}),r.set(c,new ze(d,t,i));break;default:if(He.has(h)){let f=He.get(h);r.set(c,await f({key:c,rootUrl:t,scene:e}));break}else r.set(c,await fr(c,t));break}}catch(h){console.error(h)}m()}))}),await Promise.all(p),l}a(Vi,"_preloadScriptsAssets");var ur=require("babylonjs"),ht=require("babylonjs"),gr=require("babylonjs"),dt=require("babylonjs"),vr=require("babylonjs"),Sr=require("babylonjs-gui");function Fi(t,e,i,o,r){let n=o.constructor;if(!n)return;n._NodesFromScene?.forEach(s=>{o[s.propertyKey.toString()]=Pi(s.nodeName,t)}),n._ComponentsFromScene?.length&&t.getEngine().onBeginFrameObservable.addOnce(()=>{n._ComponentsFromScene?.forEach(s=>{let c=[];if([t,...t.transformNodes,...t.meshes,...t.lights,...t.cameras].forEach(h=>{let d=Ni(h,s.componentConstructor);d&&c.push(d)}),c.length>1)throw new Error(`Multiple components of type ${n._ComponentsFromScene[0].componentConstructor.name} found in scene for property "${n._ComponentsFromScene[0].propertyKey.toString()}".`);o[s.propertyKey.toString()]=c[0]??null})}),n._NodesFromDescendants?.forEach(s=>{let c=e.getDescendants?.(s.directDescendantsOnly,m=>m.name===s.nodeName)[0];o[s.propertyKey.toString()]=c??null}),n._AnimationGroups?.forEach(s=>{o[s.propertyKey.toString()]=t.getAnimationGroupByName(s.animationGroupName)}),n._SoundsFromScene?.forEach(s=>{let c=Pi(s.soundName,t);c&&ne(c)&&(o[s.propertyKey.toString()]=c??null)}),(n._GuiFromAsset??[]).map(async s=>{let c=`${r}assets/${s.pathInAssets}`;try{let m=await B(c),h=Sr.AdvancedDynamicTexture.CreateFullscreenUI(m.name,!0,t);h.parseSerializedObject(m.content,!1),o[s.propertyKey.toString()]=h,s.onGuiCreated?.(o,h)}catch(m){throw console.error(`Failed to load GUI from asset: ${c}`),m}}),n._ParticleSystemsFromScene?.forEach(s=>{let c=t.particleSystems?.find(m=>m.name!==s.particleSystemName?!1:s.directDescendantsOnly?m.emitter===e:m);o[s.propertyKey.toString()]=c}),(n._VisibleInInspector??[]).forEach(s=>{let c=s.propertyKey.toString(),m=i.values;if(!m)throw new Error(`No values found for script with key "${i.key}".`);if(m.hasOwnProperty(c)&&m[c].hasOwnProperty("value")){let h=m[c].value;switch(s.configuration.type){case"number":case"boolean":case"keymap":case"string":o[c]=h;break;case"vector2":o[c]=dt.Vector2.FromArray(h);break;case"vector3":o[c]=dt.Vector3.FromArray(h);break;case"color3":o[c]=ht.Color3.FromArray(h);break;case"color4":o[c]=ht.Color4.FromArray(h);break;case"entity":switch(s.configuration.entityType){case"node":case"sound":o[c]=Le(h,t)??null;break;case"animationGroup":o[c]=t.getAnimationGroupByName(h)??null;break;case"particleSystem":o[c]=t.particleSystems?.find(f=>f.id===h)??null;break}break;case"texture":h&&(o[c]=gr.Texture.Parse(h,t,r));break;case"asset":if(h){let f=s.configuration.assetType,u=le.get(t).get(h);switch(f){case"json":case"gui":case"scene":case"navmesh":case"cinematic":o[c]=u;break;case"ragdoll":o[c]=Oi(u);break;case"nodeParticleSystemSet":let y=vr.NodeParticleSystemSet.Parse(u);o[c]=y;break;case"material":o[c]=ur.Material.Parse(u,t,r);break}}}}});let l=null,p=null;if(n._PointerEvents?.length){if(n._PointerEvents.find(m=>m.options.mode==="attachedMeshOnly")&&!oe(e))throw new Error('@onPointerEvent with mode "attachedMeshOnly" can only be used on scripts attached to meshes (extends AbstractMesh).');if(n._PointerEvents.find(m=>m.options.mode!=="global")&&!me(e))throw new Error('@onPointerEvent with mode different from "global" can be used only on scripts attached to Node: Mesh, Light, Camera, TransformNode.');l=t.onPointerObservable.add(m=>{let h=null;n._PointerEvents.forEach(d=>{if(!d.eventTypes.includes(m.type))return;let f=d.propertyKey.toString();if(d.options.mode==="global")return o[f]?.(m);h=m.pickInfo,h||(h=t.pick(t.pointerX,t.pointerY,u=>u.isVisible&&u.isPickable&&u.isEnabled(!0)&&!u._masterMesh,!1));let S=h.pickedMesh;if(S&&(d.options.mode==="attachedMeshOnly"&&S===e||d.options.mode==="includeDescendants"&&me(e)&&[e,...e.getDescendants(!1)].find(L=>L===S)))return o[f]?.(m)})})}if(n._KeyboardEvents?.length&&(p=t.onKeyboardObservable.add(s=>{n._KeyboardEvents.forEach(c=>{c.eventTypes.includes(s.type)&&o[c.propertyKey.toString()]?.(s)})})),n._SpritesFromSpriteManager?.length){let s=e;if(!ee(s)||!s.isSpriteManager)return console.error("@spriteFromSpriteManager decorator can only be used on SpriteManagerNode.");if(!s.spriteManager)return console.error(`SpriteManagerNode "${s.name}" has no sprite manager assigned.`);n._SpritesFromSpriteManager?.forEach(c=>{let m=s.spriteManager?.sprites.find(h=>h.name===c.spriteName)||null;o[c.propertyKey.toString()]=m})}if(n._AnimationsFromSprite?.length){if(!Ot(e))return console.error("@animationFromSprite decorator can only be used in scripts attached on Sprite.");let s=e.metadata?.spriteAnimations;if(!s?.length)return console.error(`Sprite "${e.name}" has no sprite animations assigned.`);n._AnimationsFromSprite.forEach(c=>{let m=s.find(h=>h.name===c.animationName);m?o[c.propertyKey.toString()]=m??null:console.warn(`Sprite animation named "${c.animationName}" not found on sprite "${e.name}".`)})}return n._SceneAssets?.forEach(s=>{let c=le.get(t);o[s.propertyKey.toString()]=c.get(s.sceneName)}),{observers:{pointerObserver:l,keyboardObserver:p}}}a(Fi,"applyDecorators");function G(t,e,i,o){e.metadata?.scripts&&(e.metadata.scripts?.forEach(r=>{if(!r.enabled)return;let n=i[r.key];if(!n)return;let l=n,p={};if(n.default){l=new n.default(e);let s=Fi(t,e,r,l,o);Object.assign(p,s?.observers??{})}l.onStart&&(p.onStartObserver=t.onBeforeRenderObservable.addOnce(()=>l.onStart(e))),l.onUpdate&&(p.onUpdateObserver=t.onBeforeRenderObservable.add(()=>l.onUpdate(e))),Gi(e,l,r.key,p)}),e.metadata.scripts=void 0)}a(G,"_applyScriptsForObject");function Ca(t,e,i){if(i??=t.getScene?.(),!i)throw new Error("Cannot apply script on object: no scene available.");let o=new e(t),r={};return Fi(i,t,{values:{}},o,""),o.onStart&&(r.onStartObserver=i.onBeforeRenderObservable.addOnce(()=>o.onStart())),o.onUpdate&&i.onBeforeRenderObservable.add(()=>o.onUpdate()),Gi(t,o,"runtime",r),o}a(Ca,"applyScriptOnObject");var z=new Map;function Gi(t,e,i,o){let r={key:i,observers:o,instance:e};z.has(t)?z.get(t).push(r):z.set(t,[r]),(me(t)||wt(t)||_t(t)||ne(t))&&t.onDisposeObservable.addOnce((()=>{z.get(t)?.slice()?.forEach(l=>{mt(t,l)}),z.delete(t)}))}a(Gi,"_registerScriptInstance");function mt(t,e){e.observers.onStartObserver?.remove(),e.observers.onUpdateObserver?.remove(),e.observers.pointerObserver?.remove(),e.observers.keyboardObserver?.remove();try{e.instance.onStop?.(t)}catch(r){console.error(`Failed to call onStop for script ${e.key} on object ${t}`,r)}let i=z.get(t),o=i?.indexOf(e)??-1;o!==-1&&i?.splice(o,1)}a(mt,"_removeRegisteredScriptInstance");function Pe(t,e){return z.get(t)?.filter(r=>r.instance.constructor===e)?.map(r=>r.instance)??null}a(Pe,"getAllScriptsByClassForObject");function Ni(t,e){return Pe(t,e)?.[0]??null}a(Ni,"getScriptByClassForObject");var br=require("babylonjs"),yr=!1;function xr(){yr||(yr=!0,(0,br.AddParser)("MeshEditorPlugin",(t,e,i,o)=>{t.meshes?.forEach(r=>{r.instances?.forEach(n=>{let l=i.meshes?.find(p=>p.id===n.id);l&&n.billboardMode!==void 0&&(l.billboardMode=n.billboardMode)})})}))}a(xr,"registerMeshParser");var Cr=!1;function La(t){Cr=t}a(La,"setUseKtx2CompressedTextures");function ke(){return Cr}a(ke,"isUsingKtx2CompressedTextures");function ft(t){return`${t.substring(0,t.lastIndexOf("."))}.ktx2`}a(ft,"_getKtx2TextureName");function Da(t){t.setCompressedTextureExclusions([".env",".hdr",".dds"]),t.setTextureFormatToUse(["-dxt.ktx","-astc.ktx","-pvrtc.ktx","-etc1.ktx","-etc2.ktx"])}a(Da,"configureEngineToUseCompressedTextures");function ut(t,e){t._excludedCompressedTextures&&!t._excludedCompressedTextures?.includes(e)&&t._excludedCompressedTextures?.push(e)}a(ut,"addExcludedCompressedTexture");function _a(t,e,i){e.loadingTexturesQuality!==t&&(e.loadingTexturesQuality=t,e.textures.forEach(o=>{if(!Ae(o)||!o.url)return;let r=gt(o,e);!r||o.url.includes(r)||o.updateURL(i+r)}))}a(_a,"applyTexturesQuality");function gt(t,e){if(e.loadingTexturesQuality==="high"||!t.metadata?.baseSize)return t.name;let i=t.metadata.baseSize.width,o=t.metadata.baseSize.height,r=i===F(i)||o===F(o),n="";switch(e.loadingTexturesQuality){case"medium":let d=i*.66>>0,f=o*.66>>0;r&&(d=F(d),f=F(f)),n=`_${d}_${f}`;break;case"low":case"very-low":let S=i*.33>>0,u=o*.33>>0;r&&(S=F(S),u=F(u)),n=`_${S}_${u}`;break}let l=t.name;if(!l||!n)return t.name;let p=l.split("/"),s=p.pop();if(!s)return t.name;let c=s.split(".").pop(),h=`${s.replace(`.${c}`,"")}${n}.${c}`;return p.push(h),p.join("/")}a(gt,"getTextureUrl");var Bi=require("babylonjs"),Lr=!1;function Dr(){if(Lr)return;Lr=!0;let t=Bi.SerializationHelper._TextureParser;Bi.SerializationHelper._TextureParser=(e,i,o)=>{ke()&&(e.name&&(e.name=ft(e.name)),e.url&&(e.url=ft(e.url)));let r=gt(e,i);if(!r)return t(e,i,o);let n=e.name;e.name=r;let l=t(e,i,o);return l&&(l.name=n),l}}a(Dr,"registerTextureParser");function zi(t){if(!Array.isArray(t.frames)){let e=[];for(let i of Object.keys(t.frames))e.push({filename:i,...t.frames[i]});t.frames=e}}a(zi,"normalizeAtlasJson");function Pa(t,e,i){let r=(t.metadata?.spriteAnimations??[]).find(n=>n.name===e);if(!r)return console.error(`Animation with name "${e}" not found on sprite.`);t.playAnimation(r.from,r.to,r.loop,r.delay,i)}a(Pa,"playSpriteAnimationFromName");var Pr=require("babylonjs"),wr=require("babylonjs"),Or=require("babylonjs"),Er=require("babylonjs"),Hi=require("babylonjs"),we=require("babylonjs"),Tr=require("babylonjs"),_r=!1;function Ar(){_r||(_r=!0,(0,Tr.AddParser)("SpriteMapNode",(t,e,i,o)=>{t.transformNodes?.forEach(r=>{if(!r.isSpriteMap)return;let n=i.transformNodes?.find(s=>s.id===r.id);if(!n)return;n.isSpriteMap=r.isSpriteMap;let l=`${o}${r.atlasJsonRelativePath}`;e.addPendingData(l);let p=new Or.WebRequest;p.open("GET",l),p.send(),p.addEventListener("load",()=>{e.removePendingData(l);let s=JSON.parse(p.responseText);zi(s);let c=`${Pr.Tools.GetFolderPath(l)}${s.meta.image}`,m=new Hi.Texture(c,e,!1,!1,Hi.Texture.NEAREST_NEAREST,null,null,null,!1,wr.Engine.TEXTUREFORMAT_RGBA),h=new Er.SpriteMap(n.name,s,m,{layerCount:r.options.layerCount,stageSize:we.Vector2.FromArray(r.options.stageSize??[10,1]),outputSize:we.Vector2.FromArray(r.options.outputSize??[100,100]),colorMultiply:we.Vector3.FromArray(r.options.colorMultiply??[1,1,1]),flipU:!0},e);r.getClassName=()=>"SpriteMapNode",r.tiles.forEach(f=>{for(let S=0,u=f.repeatCount.x+1;S<u;++S)for(let y=0,L=f.repeatCount.y+1;y<L;++y){let _=S*(f.repeatOffset.x+1),x=y*(f.repeatOffset.y+1);h.changeTiles(f.layer,new we.Vector2(f.position.x+_,(h.options.stageSize?.y??0)-1-f.position.y-x),f.tile)}});let d=h._output;d.parent=n,n.spriteMap=h})})}))}a(Ar,"registerSpriteMapParser");var Mr=require("babylonjs"),Rr=require("babylonjs"),vt=require("babylonjs"),Vr=require("babylonjs"),Ir=!1;function Fr(){if(Ir)return;Ir=!0,(0,Vr.RegisterShadowGeneratorSceneComponent)(Rr.ShadowGenerator);let t=(0,vt.GetParser)(Mr.SceneComponentConstants.NAME_SHADOWGENERATOR);(0,vt.AddParser)("ShadowGeneratorEditorPlugin",(e,i,o,r)=>{let n=new Map;e.shadowGenerators?.forEach(l=>{if(n.set(l.id,l.mapSize),i.loadingShadowsQuality!=="high"){switch(i.loadingShadowsQuality){case"medium":l.mapSize=l.mapSize*.5;break;case"low":l.mapSize=l.mapSize*.25;break;case"very-low":l.mapSize=l.mapSize*.125;break}l.mapSize=Math.max(128,F(l.mapSize))}}),t?.(e,i,o,r),i.lights.forEach(l=>{let p=l.getShadowGenerator();if(p?.getShadowMap()){let c=p.id,m=n.get(c);m&&(p.originalMapSize=m)}})})}a(Fr,"registerShadowGeneratorParser");var Br=require("babylonjs"),zr=require("babylonjs"),Hr=require("babylonjs"),ki=require("babylonjs"),kr=require("babylonjs");function Nr(t,e){e?.fogEnabled!==void 0&&(t.fogEnabled=e?.fogEnabled),e?.blendMode!==void 0&&(t.blendMode=e?.blendMode),e?.disableDepthWrite!==void 0&&(t.disableDepthWrite=e?.disableDepthWrite),e?.pixelPerfect!==void 0&&(t.pixelPerfect=e?.pixelPerfect),e?.useLogarithmicDepth!==void 0&&(t.useLogarithmicDepth=e?.useLogarithmicDepth),e?.metadata!==void 0&&(t.metadata=e?.metadata);for(let i of e?.sprites??[]){let o=zr.Sprite.Parse(i,t);o.uniqueId=i.uniqueId,o.metadata=i.metadata}}a(Nr,"parseSerializedSpriteManager");var Gr=!1;function Ur(){Gr||(Gr=!0,(0,kr.AddParser)("SpriteManagerNode",(t,e,i,o)=>{t.transformNodes?.forEach(r=>{if(!r.isSpriteManager)return;let n=i.transformNodes?.find(p=>p.id===r.id);if(!n)return;let l=e.getEngine();if(n.isSpriteManager=r.isSpriteManager,r.atlasJsonRelativePath){let p=`${o}${r.atlasJsonRelativePath}`;e.addPendingData(p);let s=new Hr.WebRequest;s.open("GET",p),s.send(),s.addEventListener("load",()=>{e.removePendingData(p);let c=JSON.parse(s.responseText),m=`${Br.Tools.GetFolderPath(p)}${c.meta.image}`;ut(l,m);let h=new ki.SpriteManager(n.name,m,1e3,64,e,void 0,void 0,!0,c);n.spriteManager=h,n.getClassName=()=>"SpriteManagerNode",r.spriteManager&&Nr(h,r.spriteManager)})}else if(r.spriteManager?.textureUrl){ut(l,r.spriteManager.textureUrl);let p=`${o}${r.spriteManager.textureUrl}`,s=new ki.SpriteManager(n.name,p,1e3,{width:r.spriteManager.cellWidth,height:r.spriteManager.cellHeight},e,void 0,void 0,!1);n.spriteManager=s,n.getClassName=()=>"SpriteManagerNode",r.spriteManager&&Nr(s,r.spriteManager)}})}))}a(Ur,"registerSpriteManagerParser");var Xr=require("babylonjs"),$r=require("babylonjs"),Wr=!1;function Kr(){Wr||(Wr=!0,(0,$r.AddParser)("MorphTargetManagerEditorPlugin",(t,e,i,o)=>{t.morphTargetManagers.forEach(r=>{let l=i.meshes.find(c=>c.id===r.meshId)?.morphTargetManager;if(!l||r.targets.find(c=>!c.delayLoadingFile))return;let s=[];r.targets.forEach(c=>{if(!c.delayLoadingFile)return s.push(Promise.resolve(null));let m=`${o}${c.delayLoadingFile}`;e.addPendingData(m);let h=new Xr.WebRequest;h.responseType="arraybuffer",h.open("GET",m),h.send(),s.push(new Promise(d=>{h.addEventListener("load",()=>{e.removePendingData(m),d(h.response)})}))}),Promise.all(s).then(c=>{for(let m=0,h=l.numTargets;m<h;++m){let d=l.getTarget(m),f=r.targets[m],S=c[m];if(f.positionsCount){let u=new Float32Array(S,f.positionsOffset,f.positionsCount);d._positions=u,d.setPositions(u)}if(f.normalsCount){let u=new Float32Array(S,f.normalsOffset,f.normalsCount);d._normals=u,d.setNormals(u)}if(f.tangentsCount){let u=new Float32Array(S,f.tangentsOffset,f.tangentsCount);d._tangents=u,d.setTangents(u)}if(f.uvsCount){let u=new Float32Array(S,f.uvsOffset,f.uvsCount);d._uvs=u,d.setUVs(u)}if(f.uv2sCount){let u=new Float32Array(S,f.uv2sOffset,f.uv2sCount);d._uv2s=u,d.setUV2s(u)}}for(let m=0,h=l.numTargets;m<h;++m)l.getTarget(m)._onDataLayoutChanged.notifyObservers()})})}))}a(Kr,"registerMorphTargetManagerParser");var Zr=require("babylonjs"),Yr=require("babylonjs"),jr=!1;function qr(){jr||(jr=!0,(0,Zr.AddParser)("NodeParticleSystemSetEditorPlugin",(t,e,i,o)=>{t.meshes?.forEach(r=>{if(!r.isNodeParticleSystemMesh)return;let n=i.meshes?.find(l=>l.id===r.id);n&&(r.nodeParticleSystemSet.blocks?.forEach(l=>{l.url&&(l.url=`${o}${l.url}`)}),n.nodeParticleSystemSet=Yr.NodeParticleSystemSet.Parse(r.nodeParticleSystemSet),n.nodeParticleSystemSet.id=r.nodeParticleSystemSet.id,n.nodeParticleSystemSet.uniqueId=r.uniqueId,e.addPendingData(r.id),n.nodeParticleSystemSet.buildAsync(e,!1).then(l=>{e.removePendingData(r.id),n.particleSystemSet=l,l.systems.forEach(p=>{if(Pt(p)){let s=p._sizeCreation.process;s&&(p._sizeCreation.process=(c,m)=>{s(c,m),c.scale.x*=100,c.scale.y*=100})}}),l.emitterNode=n,l.start()}))})}))}a(qr,"registerNodeParticleSystemSetParser");var Qr=require("babylonjs");function Jr(t,e){e??=new Qr.ClusteredLightContainer("Clustered Light Container",[],t);let i=t.metadata?.clusteredLight;return i&&(i.lights.length>0&&(e.horizontalTiles=i.horizontalTiles,e.verticalTiles=i.verticalTiles,e.depthSlices=i.depthSlices,e.maxRange=i.maxRange),i.lights.forEach(o=>{let r=t.getLightById(o);r&&e?.addLight(r)})),e}a(Jr,"configureLights");var tn=require("babylonjs"),Wi=require("babylonjs"),on=require("babylonjs"),rn=require("babylonjs"),Ui=new Map;async function en(t,e){let i=t.getWaitingItemsCount();for(;!t.isDisposed&&(!t.isReady()||t.getWaitingItemsCount()>0);){await new Promise(r=>setTimeout(r,150));let o=i-t.getWaitingItemsCount();o===i&&t.textures.forEach(r=>{r.delayLoadState===Wi.Constants.DELAYLOADSTATE_NONE&&(r.delayLoadState=Wi.Constants.DELAYLOADSTATE_LOADED)}),e(o/i)}}a(en,"waitForWaitingItems");async function wa(t,e,i,o,r){i.loadingQuality=r?.quality??"high",i.loadingTexturesQuality=r?.texturesQuality??i.loadingQuality,i.loadingShadowsQuality=r?.shadowsQuality??i.loadingQuality,i.loadingLodsQuality=r?.lodsQuality??i.loadingQuality,xr(),cr(),Dr(),Fr(),Kr(),Ar(),Ur(),qr();let n=Ui.get(i)??{};if(Ui.set(i,n),i.onDisposeObservable.addOnce(()=>{Ui.delete(i)}),await(0,on.AppendSceneAsync)(`${t}${e}`,i,{pluginExtension:".babylon",onProgress:a(p=>{let s=Math.min(p.loaded/p.total*.5);r?.onProgress?.(s)},"onProgress")}),await en(i,p=>{r?.onProgress?.(.5+p*.25)}),!r?.skipAssetsPreload){let p=0;do p=await Vi(t,i,o);while(p!==0&&!i.isDisposed)}rn.SceneLoaderFlags.ForceFullSceneLoadingForIncremental&&i.meshes.forEach(p=>V(p)&&p._checkDelayState());let l=Jr(i,n.clusteredLightContainer);n.clusteredLightContainer=l,await en(i,p=>{r?.onProgress?.(.75+p*.25)}),r?.onProgress?.(1),At(i),It(i.loadingLodsQuality,i),Mt(i),qe(i),i.metadata?.rendering&&(jo(i,i.metadata.rendering),i.activeCamera&&_i(i.activeCamera,t,r?.postProcessConfiguration)),i.metadata?.physicsGravity&&i.getPhysicsEngine()?.setGravity(tn.Vector3.FromArray(i.metadata?.physicsGravity)),G(i,i,o,t),i.transformNodes.forEach(p=>{G(i,p,o,t)}),i.meshes.forEach(p=>{Ko(p),G(i,p,o,t)}),i.lights.forEach(p=>{G(i,p,o,t)}),l.lights.forEach(p=>{G(i,p,o,t)}),i.cameras.forEach(p=>{G(i,p,o,t)}),i.spriteManagers?.forEach(p=>{p.sprites.forEach(s=>{G(i,s,o,t)})}),_e(i)}a(wa,"loadScene");var nn=require("babylonjs");async function Oa(t,e,i){let o=await B(t+e),n=nn.Tools.Instantiate(o.customType).Parse(o,i,t);return n.id=o.id,n.uniqueId=o.uniqueId,n}a(Oa,"loadMaterialFromFile");function Ea(t){return Promise.all(t.materials.map(async e=>{let i=e.getBindedMeshes();await Promise.all(i.map(async o=>{Te(o)||await e.forceCompilationAsync(o,{clipPlane:!!t.clipPlane,useInstances:o.hasInstances})}))}))}a(Ea,"forceCompileAllSceneMaterials");var Q=require("babylonjs");function Ue(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Q.Animation.ANIMATIONTYPE_FLOAT;switch(t?.getClassName?.()){case"Vector2":return Q.Animation.ANIMATIONTYPE_VECTOR2;case"Vector3":return Q.Animation.ANIMATIONTYPE_VECTOR3;case"Quaternion":return Q.Animation.ANIMATIONTYPE_QUATERNION;case"Color3":return Q.Animation.ANIMATIONTYPE_COLOR3;case"Color4":return Q.Animation.ANIMATIONTYPE_COLOR4;case"Size":return Q.Animation.ANIMATIONTYPE_SIZE;case"Matrix":return Q.Animation.ANIMATIONTYPE_MATRIX}return null}a(Ue,"getAnimationTypeForObject");var an=require("babylonjs");function Ta(t){return function(e,i){let o=e.constructor;o._NodesFromScene??=[],o._NodesFromScene.push({propertyKey:i,nodeName:t})}}a(Ta,"nodeFromScene");function Aa(t){return function(e,i){let o=e.constructor;o._ComponentsFromScene??=[],o._ComponentsFromScene.push({propertyKey:i,componentConstructor:t})}}a(Aa,"componentFromScene");function Ia(t,e=!1){return function(i,o){let r=i.constructor;r._NodesFromDescendants??=[],r._NodesFromDescendants.push({propertyKey:o,nodeName:t,directDescendantsOnly:e})}}a(Ia,"nodeFromDescendants");function Ma(t){return function(e,i){let o=e.constructor;o._AnimationGroups??=[],o._AnimationGroups.push({animationGroupName:t,propertyKey:i})}}a(Ma,"animationGroupFromScene");function Ra(t){return function(e,i){let o=e.constructor;o._SceneAssets??=[],o._SceneAssets.push({sceneName:t,propertyKey:i})}}a(Ra,"sceneAsset");function Va(t,e){return function(i,o){let r=i.constructor;r._GuiFromAsset??=[],r._GuiFromAsset.push({propertyKey:o,pathInAssets:t,onGuiCreated:e})}}a(Va,"guiFromAsset");function Fa(t){return function(e,i){let o=e.constructor;o._SoundsFromScene??=[],o._SoundsFromScene.push({propertyKey:i,soundName:t})}}a(Fa,"soundFromScene");function Na(t,e=!1){return function(i,o){let r=i.constructor;r._ParticleSystemsFromScene??=[],r._ParticleSystemsFromScene.push({propertyKey:o,particleSystemName:t,directDescendantsOnly:e})}}a(Na,"particleSystemFromScene");function Ga(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"boolean"}})}}a(Ga,"visibleAsBoolean");function Ba(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"string"}})}}a(Ba,"visibleAsString");function za(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"number"}})}}a(za,"visibleAsNumber");function Ha(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"vector2"}})}}a(Ha,"visibleAsVector2");function ka(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"vector3"}})}}a(ka,"visibleAsVector3");function Ua(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"color3"}})}}a(Ua,"visibleAsColor3");function Wa(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"color4"}})}}a(Wa,"visibleAsColor4");function Xa(t,e,i){return function(o,r){let n=o.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...i,entityType:t,type:"entity"}})}}a(Xa,"visibleAsEntity");function $a(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"texture"}})}}a($a,"visibleAsTexture");function Ka(t,e){return function(i,o){let r=i.constructor;r._VisibleInInspector??=[],r._VisibleInInspector.push({label:t,propertyKey:o,configuration:{...e,type:"keymap"}})}}a(Ka,"visibleAsKeyMap");function ja(t,e,i){return function(o,r){let n=o.constructor;n._VisibleInInspector??=[],n._VisibleInInspector.push({label:e,propertyKey:r,configuration:{...i,assetType:t,type:"asset"}})}}a(ja,"visibleAsAsset");function Za(t,e){return function(i,o){let r=i.constructor;r._PointerEvents??=[],r._PointerEvents.push({propertyKey:o,options:{mode:"global",...e??{}},eventTypes:Array.isArray(t)?t:[t]})}}a(Za,"onPointerEvent");function Ya(t){return function(e,i){let o=e.constructor;o._KeyboardEvents??=[],o._KeyboardEvents.push({propertyKey:i,eventTypes:Array.isArray(t)?t:[t]})}}a(Ya,"onKeyboardEvent");function qa(t){return function(e,i){let o=e.constructor;o._SpritesFromSpriteManager??=[],o._SpritesFromSpriteManager.push({propertyKey:i,spriteName:t})}}a(qa,"spriteFromSpriteManager");function Qa(t){return function(e,i){let o=e.constructor;o._AnimationsFromSprite??=[],o._AnimationsFromSprite.push({propertyKey:i,animationName:t})}}a(Qa,"animationFromSprite");var St=require("babylonjs");function hv(t,e){let i;return t===St.Animation.ANIMATIONTYPE_FLOAT?i=e.value:i=e.value.clone(),{value:i,frame:e.frame,interpolation:e.interpolation,inTangent:t===St.Animation.ANIMATIONTYPE_FLOAT?e.inTangent:e.inTangent?.clone(),outTangent:t===St.Animation.ANIMATIONTYPE_FLOAT?e.outTangent:e.outTangent?.clone()}}a(hv,"cloneKey");function yt(t,e){let i=e.split("."),o=t;for(let r=0;r<i.length;++r)o=o[i[r]];return o}a(yt,"getPropertyValue");function Xi(t,e,i){let o=null;t.onAnimationGroupPlayObservable.add(()=>{o=e.onAfterAnimationsObservable.add(()=>{i()})}),t.onAnimationGroupPauseObservable.add(()=>{o&&(e.onAfterAnimationsObservable.remove(o),o=null)}),t.onAnimationGroupEndObservable.add(()=>{o&&(e.onAfterAnimationsObservable.remove(o),o=null)})}a(Xi,"registerAfterAnimationCallback");var J=require("babylonjs"),bt=require("babylonjs"),k=require("babylonjs");function Ja(t,e){return{name:t.name,framesPerSecond:t.framesPerSecond,outputFramesPerSecond:t.outputFramesPerSecond,tracks:t.tracks.map(i=>{let o=null,r=null;if(i.node?(o=Le(i.node,e),o||(o=e.particleSystems?.find(l=>l.id===i.node)??null)):i.defaultRenderingPipeline?o=Ie():i.volumetricLightScattering&&(o=Rt()),i.propertyPath){let l=yt(o,i.propertyPath);r=Ue(l)}let n=null;return i.sound&&(n=Le(i.sound,e)),{node:o,sound:n,propertyPath:i.propertyPath,defaultRenderingPipeline:i.defaultRenderingPipeline,volumetricLightScattering:i.volumetricLightScattering,animationGroupWeight:i.animationGroupWeight,animationGroup:i.animationGroup?e.getAnimationGroupByName(i.animationGroup):null,animationGroups:i.animationGroups,sounds:i.sounds,soundVolume:$i(i.soundVolume??[],J.Animation.ANIMATIONTYPE_FLOAT),keyFrameEvents:i.keyFrameEvents?.map(l=>{let p={...l};switch(l.data?.type){case"set-enabled":p.data={type:"set-enabled",value:l.data.value,node:Le(l.data.node,e)};break;case"apply-impulse":p.data={type:"apply-impulse",radius:l.data.radius,mesh:e.getMeshById(l.data.mesh),force:k.Vector3.FromArray(l.data.force),contactPoint:k.Vector3.FromArray(l.data.contactPoint)};break}return p}),keyFrameAnimations:o&&r!==null&&$i(i.keyFrameAnimations??[],r)}})}}a(Ja,"parseCinematic");function H(t,e){if(t===null)return null;if(t!==void 0)switch(e){case J.Animation.ANIMATIONTYPE_FLOAT:return t;case J.Animation.ANIMATIONTYPE_VECTOR2:return k.Vector2.FromArray(t);case J.Animation.ANIMATIONTYPE_VECTOR3:return k.Vector3.FromArray(t);case J.Animation.ANIMATIONTYPE_QUATERNION:return k.Quaternion.FromArray(t);case J.Animation.ANIMATIONTYPE_COLOR3:return bt.Color3.FromArray(t);case J.Animation.ANIMATIONTYPE_COLOR4:return bt.Color4.FromArray(t);case J.Animation.ANIMATIONTYPE_MATRIX:return k.Matrix.FromArray(t)}}a(H,"parseCinematicKeyValue");function $i(t,e){return t?.map(i=>{let o=i.type==="key"?i:null;if(o)return{...o,value:H(o.value,e),inTangent:H(o.inTangent,e),outTangent:H(o.outTangent,e)};let r=i.type==="cut"?i:null;if(r)return{...r,key1:{...r.key1,value:H(r.key1.value,e),inTangent:H(r.key1.inTangent,e),outTangent:H(r.key1.outTangent,e)},key2:{...r.key2,value:H(r.key2.value,e),inTangent:H(r.key2.inTangent,e),outTangent:H(r.key2.outTangent,e)}};throw new Error(`Unknown key frame type: ${i.type}`)})}a($i,"parseKeyFrameAnimations");function sn(t,e){t.onEventObservable.notifyObservers(e.eventName)}a(sn,"handleApplyEvent");function ln(t){t.node?.setEnabled(t.value)}a(ln,"handleSetEnabledEvent");var Ki=require("babylonjs"),cn=Ki.Vector3.Zero();function pn(t,e){let i=e.mesh?[e.mesh]:t.meshes.filter(o=>o.physicsAggregate);e.radius&&(i=i.filter(o=>{let r=o.getBoundingInfo().boundingBox.centerWorld;return Ki.Vector3.Distance(r,e.contactPoint)<=e.radius})),i.forEach(o=>{if(o.physicsAggregate?.body){let r=e.contactPoint.subtract(o.getBoundingInfo().boundingBox.centerWorld);r.multiplyInPlace(e.force),o.physicsAggregate.body.setLinearVelocity(cn),o.physicsAggregate.body.setAngularVelocity(cn),o.physicsAggregate.body.applyImpulse(r.negateInPlace(),e.contactPoint)}})}a(pn,"handleApplyImpulseEvent");var mn=require("babylonjs"),hn=require("babylonjs"),We=class extends hn.AnimationGroup{static{a(this,"Cinematic")}onEventObservable=new mn.Observable;onEvent(e,i){this.onEventObservable.add(o=>{e===o&&i()})}};function ji(t){return t.type==="key"}a(ji,"isCinematicKey");function Oe(t){return t.type==="cut"}a(Oe,"isCinematicKeyCut");function es(t){return t.type==="event"}a(es,"isCinematicKeyEvent");function ts(t){return t.type==="group"}a(ts,"isCinematicGroup");function is(t){return t.type==="sound"}a(is,"isCinematicSound");var O=require("babylonjs"),Ee=require("babylonjs");function os(t,e,i){let o=new We(t.name,e);return t.tracks.forEach(r=>{let n=r.animationGroup;if(n&&r.animationGroups?.length){let d=n.clone(`${n.name}-cinematic-temp`),f=e.animationGroups.indexOf(d);f!==-1&&e.animationGroups.splice(f,1),o.onAnimationEndObservable.add(()=>{n.stop(),d.stop()});let S=r.animationGroups.reduce((_,x)=>Math.min(_,x.frame),Number.MAX_VALUE)??0,u=r.animationGroups.reduce((_,x)=>Math.max(_,x.frame+x.endFrame),0)??0,y={frame:S},L=new O.Animation(d.name,"frame",60,O.Animation.ANIMATIONTYPE_FLOAT,O.Animation.ANIMATIONLOOPMODE_CYCLE,!1);if(L.setKeys([{frame:S,value:0},{frame:u,value:u}]),r.animationGroups.forEach(_=>{L.addEvent(new Ee.AnimationEvent(_.frame,()=>{let x=_.repeatCount??0;if(d.to=_.endFrame,d.speedRatio=_.speed,d.stop(),d.play(x>0),d.from!==_.startFrame&&d.goToFrame(_.startFrame),x){let M=0;d.onAnimationGroupLoopObservable.add(()=>{++M,M>x&&d.stop()})}}))}),o.addTargetedAnimation(L,y),(r.animationGroupWeight?.length??0)>=2&&r.animationGroupWeight.find(x=>Oe(x)?x.key1.value!==1||x.key2.value!==1:x.value!==1)){let x={weight:0},M=new O.Animation(`${d.name}-weights`,"weight",60,O.Animation.ANIMATIONTYPE_FLOAT,O.Animation.ANIMATIONLOOPMODE_CYCLE,!1),N=[];r.animationGroupWeight.forEach(v=>{Oe(v)?(N.push(v.key1),N.push(v.key2)):N.push(v)}),M.setKeys(N),o.addTargetedAnimation(M,x),Xi(o,e,()=>{d.weight=x.weight})}}let l=r.sound;if(!i?.ignoreSounds&&l&&l.sound?.buffer&&r.sounds?.length){let d={dummy:0,volume:0},f=new O.Animation(l.name,"dummy",60,O.Animation.ANIMATIONTYPE_FLOAT,O.Animation.ANIMATIONLOOPMODE_CYCLE,!1),S=0;if(r.sounds?.forEach(u=>{let y=u.endFrame-u.startFrame;S=Math.max(S,u.frame+y),f.addEvent(new Ee.AnimationEvent(u.frame,L=>{let x=(L-u.frame+u.startFrame)/t.framesPerSecond;l.play({startOffset:x})},!1)),f.addEvent(new Ee.AnimationEvent(u.frame+y,()=>{l.stop()}))}),f.setKeys([{frame:0,value:0},{frame:S,value:S}]),o.addTargetedAnimation(f,d),(r.soundVolume?.length??0)>=2){let u=new O.Animation(l.name,"volume",60,O.Animation.ANIMATIONTYPE_FLOAT,O.Animation.ANIMATIONLOOPMODE_CYCLE,!1),y=[];r.soundVolume.forEach(L=>{Oe(L)?(y.push(L.key1),y.push(L.key2)):y.push(L)}),u.setKeys(y),o.addTargetedAnimation(u,d),Xi(o,e,()=>{l.volume=d.volume})}}if(r.keyFrameEvents){let d={dummy:0},f=new O.Animation("events","dummy",60,O.Animation.ANIMATIONTYPE_FLOAT,O.Animation.ANIMATIONLOOPMODE_CYCLE,!1),S=0;r.keyFrameEvents?.forEach(u=>{S=Math.max(S,u.frame),f.addEvent(new Ee.AnimationEvent(u.frame,()=>{switch(u.data?.type){case"event":sn(o,u.data);break;case"set-enabled":ln(u.data);break;case"apply-impulse":pn(e,u.data);break}}))}),f.setKeys([{frame:0,value:0},{frame:S+1,value:S+1}]),o.addTargetedAnimation(f,d)}let p=r.defaultRenderingPipeline?Ie():r.node;if(!p||!r.propertyPath||!r.keyFrameAnimations)return;let s=yt(p,r.propertyPath),c=Ue(s);if(c===null)return;let m=new O.Animation(r.propertyPath,r.propertyPath,60,c,O.Animation.ANIMATIONLOOPMODE_CYCLE,!1),h=[];r.keyFrameAnimations?.forEach(d=>{if(ji(d))return h.push(d);Oe(d)&&(h.push(d.key1),h.push(d.key2),Ze(p)&&r.propertyPath==="position"&&m.addEvent(new Ee.AnimationEvent(d.key1.frame,()=>{let f=Kt();if(!f)return;let S=f.motionStrength;f.motionStrength=0,requestAnimationFrame(()=>{f.motionStrength=S})})))}),m.setKeys(h),o.addTargetedAnimation(m,p)}),o.normalize(),o}a(os,"generateCinematicAnimationGroup");async function Zi(t,e){return new Promise((i,o)=>{let r=indexedDB.open(t,1);r.addEventListener("error",()=>o()),r.addEventListener("blocked",()=>o()),r.addEventListener("upgradeneeded",()=>{try{e(r.result)}catch(n){o(n)}}),r.addEventListener("success",()=>{i(r.result)})})}a(Zi,"openIndexDB");function Xe(t,e,i){return new Promise(o=>{let n=t.transaction(e).objectStore(e).get(i);n.addEventListener("error",()=>{o(null)}),n.addEventListener("success",()=>{o(n.result??null)})})}a(Xe,"getFromIndexDB");async function U(t,e,i){let r=t.transaction(e,"readwrite").objectStore(e).put(i);await new Promise((n,l)=>{r.addEventListener("error",()=>l()),r.addEventListener("success",()=>n())})}a(U,"putInIndexDB");var dn=require("babylonjs");function rs(t){dn.AbstractEngine.OfflineProviderFactory=(e,i,o=!1)=>new $e(t,e,i,o)}a(rs,"setupOfflineProvider");async function Yi(t,e){let i=await new Promise(o=>{let r=new $e(t,e,n=>o(n?r:null),!1)});return await i?.open(),i}a(Yi,"createAndOpenDatabase");var $e=class{static{a(this,"Database")}enableSceneOffline=!0;enableTexturesOffline=!0;name;_database=null;_manifestVersion=null;_loadFilePromises=new Map;constructor(e,i,o,r){this.name=e,r?o(!1):this._checkManifest(i,o)}async _checkManifest(e,i){try{let o=await B(`${e}.manifest?${Date.now()}`);this._manifestVersion=o.version,i(!0)}catch{this.enableSceneOffline=!1,this.enableTexturesOffline=!1,i(!1)}}async open(e,i){try{this._database=await Zi(this.name,o=>{o.createObjectStore("files",{keyPath:"url"}),o.createObjectStore("images",{keyPath:"url"}),o.createObjectStore("versions",{keyPath:"url"})}),e?.()}catch{i?.()}}close(){this._database?.close(),this._database=null,this._loadFilePromises.clear()}async loadImage(e,i){if(!this._database){i.src=e;return}let o=null;await Ei(()=>this._manifestVersion!==null);let r=this._loadFilePromises.get(e);if(r)return r.then(l=>{l!==null?i.src=l:i.src=e});let n=new Promise(async l=>{if(await this._getFileVersionForUrl(e)!==this._manifestVersion?(o=await Ce(e,"blob"),await Promise.all([U(this._database,"images",{url:e,data:o}),U(this._database,"versions",{url:e,version:this._manifestVersion})])):o=(await Xe(this._database,"images",e))?.data??null,o!==null){let s=URL.createObjectURL(o);i.src=s}else i.src=e;l(i.src)});this._loadFilePromises.set(e,n)}async saveImage(e){if(!this._database)throw new Error("Database is not available");let i=await Ce(e,"blob");await Promise.all([U(this._database,"images",{url:e,data:i}),U(this._database,"versions",{url:e,version:this._manifestVersion})])}async isFileMatchingVersion(e){return await this._getFileVersionForUrl(e)===this._manifestVersion}async loadFile(e,i,o,r,n){if(!this._database)return r?.();let l=null;await Ei(()=>this._manifestVersion!==null);let p=this._loadFilePromises.get(e);if(p)return p.then(c=>{c!==null?i(c):r?.()});let s=new Promise(async c=>{await this._getFileVersionForUrl(e)!==this._manifestVersion?(l=await Ce(e,n?"arraybuffer":"text",o),await Promise.all([U(this._database,"files",{url:e,data:l}),U(this._database,"versions",{url:e,version:this._manifestVersion})])):l=(await Xe(this._database,"files",e))?.data??null,l!==null?i(l):r?.(),c(l)});this._loadFilePromises.set(e,s)}async saveFile(e,i,o){if(!this._database)throw new Error("Database is not available");let r=await Ce(e,i?"arraybuffer":"text",o);await Promise.all([U(this._database,"files",{url:e,data:r}),U(this._database,"versions",{url:e,version:this._manifestVersion})])}async _getFileVersionForUrl(e){return(await Xe(this._database,"versions",e))?.version??null}};var fn=["mp3","wav"],un=["babylonbinarymeshdata"],ns=["ktx","ktx2","jpg","jpeg","png","bmp","webp"],gn=["babylon","json"],qi=["jpg","jpeg","png","bmp","webp"],vn=["bin","ktx","ktx2",...un,...fn],as=[...gn,...qi,...vn];async function ss(t,e,i){let o=[],r=await B(`${e}scenes-used-files.json`),n=[];if(i?.scenesFilter){n=i.scenesFilter.map(h=>typeof h=="string"?{sceneName:h,disableSounds:!1,disableTextures:!1,disableGeometries:!1}:h);for(let[h,d]of Object.entries(r))n.find(f=>f.sceneName===h)||delete r[h]}let l=0,p=0,s=i?.engine?.textureFormatInUse?i?.engine?.texturesSupported[0]:null,c=Object.values(r).reduce((h,d)=>h+d.length,0);function m(h){++p,i?.onProgress?.(p/c),h?.()}a(m,"notifyProgress");for(let[h,d]of Object.entries(r)){let f=h.replace(".scene",".babylon"),S=await Yi(t,`${e}${f}`);if(!S)continue;let u=n.find(y=>y.sceneName===h);for(let y=0,L=d.length;y<L;++y){let _=d[y],x=_.split(".").pop()?.toLowerCase();if(!x){m();continue}if(un.includes(x)&&u?.disableGeometries){m();continue}if(ns.includes(x)&&u?.disableTextures){m();continue}if(fn.includes(x)&&u?.disableSounds){m();continue}if(qi.includes(x)&&u?.disableTextures){m();continue}if(x==="ktx")if(s){if(!_.endsWith(s)){m();continue}}else{m();continue}if(x==="ktx2"&&!ke()){m();continue}if(o.length>300){try{await Promise.all(o)}catch{}o.splice(0,o.length)}let M=`${e}${_}`;as.includes(x)&&o.push(new Promise(async N=>{if(await S.isFileMatchingVersion(M))return m(N);try{qi.includes(x)?i?.disableImages||(await S.saveImage(M),++l):vn.includes(x)?(await S.saveFile(M,!0),++l):gn.includes(x)&&(await S.saveFile(M,!1),++l)}catch{}m(N)}))}await Promise.all(o),S.close()}return await Promise.all(o),{loadedCount:l,processedFilesCount:p}}a(ss,"preloadAssetsToDatabase");0&&(module.exports={AdvancedAssetContainer,AdvancedAssetContainerInstantiatedEntries,Cinematic,Database,NodeParticleSystemSet,VolumetricDebugMode,VolumetricDepthSource,VolumetricDitherMode,VolumetricFogMode,VolumetricLightingRenderingPipeline,VolumetricShadowKind,VolumetricShadowMode,VolumetricStepDistribution,VolumetricTransmittanceMode,_applyScriptsForObject,_getKtx2TextureName,_preloadScriptsAssets,_registerScriptInstance,_removeRegisteredScriptInstance,addExcludedCompressedTexture,animationFromSprite,animationGroupFromScene,applyMeshesLODQuality,applyRagdollJointLimits,applyRenderingConfigurationForCamera,applyScriptOnObject,applyShadowsQuality,applyTexturesQuality,canUseHdr,componentFromScene,computeVolumetricBudget,computeVolumetricShapeKey,configureEngineToUseCompressedTextures,configureMeshDistanceOrScreenCoverage,configureShadowMapRefreshRate,configureShadowMapRenderListPredicate,copyAndParseRagdollConfiguration,createAndOpenDatabase,createDefaultRenderingPipeline,createMotionBlurPostProcess,createSSAO2RenderingPipeline,createSSRRenderingPipeline,createTAARenderingPipeline,createVLSPostProcess,createVolumetricLightingPrePassConfiguration,createVolumetricLightingRenderingPipeline,defaultPipelineCameraConfigurations,disposeDefaultRenderingPipeline,disposeMotionBlurPostProcess,disposeSSAO2RenderingPipeline,disposeSSRRenderingPipeline,disposeTAARenderingPipeline,disposeVLSPostProcess,disposeVolumetricLightingRenderingPipeline,ensureVolumetricLightConfiguration,forceCompileAllSceneMaterials,generateCinematicAnimationGroup,getAllScriptsByClassForObject,getAllVolumetricCandidateLights,getAnimationTypeForObject,getDefaultRenderingPipeline,getDefaultVolumetricLightConfiguration,getDefaultVolumetricLightingConfiguration,getFromIndexDB,getHdrTextureType,getMotionBlurPostProcess,getPowerOfTwoUntil,getSSAO2RenderingPipeline,getSSRRenderingPipeline,getScriptByClassForObject,getTAARenderingPipeline,getTextureUrl,getVLSPostProcess,getVolumetricGeometryBufferDepthTexture,getVolumetricGeometryBufferRenderer,getVolumetricLightConfiguration,getVolumetricLightRange,getVolumetricLightSteps,getVolumetricLightWorldDirection,getVolumetricLightWorldPosition,getVolumetricLightingRenderingPipeline,getVolumetricPrePassDepthTexture,getVolumetricPrePassRenderer,guiFromAsset,isAbstractMesh,isAnyParticleSystem,isArcRotateCamera,isBone,isCamera,isCascadedShadowGenerator,isCinematicGroup,isCinematicKey,isCinematicKeyCut,isCinematicKeyEvent,isCinematicSound,isClusteredLightContainer,isDecalMesh,isDirectionalLight,isFreeCamera,isGPUParticleSystem,isGaussianSplattingMesh,isGroundMesh,isHemisphericLight,isInstancedMesh,isLight,isMesh,isNode,isNodeFromStaticGroup,isParticleSystem,isPointLight,isScene,isShadowGenerator,isSoundNode,isSpotLight,isSprite,isTexture,isTransformNode,isUsingKtx2CompressedTextures,isVolumetricLightEnabled,isVolumetricLightSupported,isVolumetricLightingSupported,loadMaterialFromFile,loadScene,markVolumetricLightsDirty,maxVolumetricArrayLights,maxVolumetricDirectionalLights,maxVolumetricShadowSlots,motionBlurPostProcessCameraConfigurations,nodeFromDescendants,nodeFromScene,normalizeAtlasJson,normalizeVolumetricLightConfiguration,normalizeVolumetricLightingConfiguration,onKeyboardEvent,onPointerEvent,openIndexDB,parseCinematic,parseCinematicKeyValue,parseDefaultRenderingPipeline,parseKeyFrameAnimations,parseMotionBlurPostProcess,parseRagdollConfiguration,parseSSAO2RenderingPipeline,parseSSRRenderingPipeline,parseTAARenderingPipeline,parseVLSPostProcess,parseVolumetricLightingRenderingPipeline,particleSystemFromScene,playSpriteAnimationFromName,preloadAssetsToDatabase,putInIndexDB,registerScriptAssetParser,resolveVolumetricDepthSource,resolveVolumetricShadowSlot,saveRenderingConfigurationForCamera,sceneAsset,scriptAssetsCache,scriptAssetsParsers,scriptsDictionary,selectVolumetricLights,serializeDefaultRenderingPipeline,serializeMotionBlurPostProcess,serializeSSAO2RenderingPipeline,serializeSSRRenderingPipeline,serializeTAARenderingPipeline,serializeVLSPostProcess,serializeVolumetricLightingRenderingPipeline,setDefaultRenderingPipelineRef,setMotionBlurPostProcessRef,setSSAO2RenderingPipelineRef,setSSRRenderingPipelineRef,setStaticDecalsEnabled,setTAARenderingPipelineRef,setUseKtx2CompressedTextures,setVLSPostProcessRef,setVolumetricLightingRenderingPipelineRef,setupOfflineProvider,soundFromScene,spriteFromSpriteManager,ssaoRenderingPipelineCameraConfigurations,ssrRenderingPipelineCameraConfigurations,supportsVolumetricFloatDepthTexture,taaRenderingPipelineCameraConfigurations,visibleAsAsset,visibleAsBoolean,visibleAsColor3,visibleAsColor4,visibleAsEntity,visibleAsKeyMap,visibleAsNumber,visibleAsString,visibleAsTexture,visibleAsVector2,visibleAsVector3,vlsPostProcessCameraConfigurations,volumetricLightMetadataKey,volumetricLightingPrePassConfigurationName,volumetricLightingRenderingPipelineCameraConfigurations});
@@ -130,7 +130,8 @@ export function applyDecorators(scene, object, script, instance, rootUrl) {
130
130
  case "asset":
131
131
  if (value) {
132
132
  const assetType = params.configuration.assetType;
133
- const data = scriptAssetsCache.get(value);
133
+ const assetsCache = scriptAssetsCache.get(scene);
134
+ const data = assetsCache.get(value);
134
135
  switch (assetType) {
135
136
  case "json":
136
137
  case "gui":
@@ -244,7 +245,8 @@ export function applyDecorators(scene, object, script, instance, rootUrl) {
244
245
  }
245
246
  // @sceneAsset
246
247
  ctor._SceneAssets?.forEach((params) => {
247
- instance[params.propertyKey.toString()] = scriptAssetsCache.get(params.sceneName);
248
+ const assetsCache = scriptAssetsCache.get(scene);
249
+ instance[params.propertyKey.toString()] = assetsCache.get(params.sceneName);
248
250
  });
249
251
  return {
250
252
  observers: {
@@ -1 +1 @@
1
- {"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/decorators/apply.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAIlE,OAAO,EAAE,OAAO,EAAE,MAAM,4CAA4C,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sDAAsD,CAAC;AAE7F,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AA0FpE,MAAM,UAAU,eAAe,CAAC,KAAY,EAAE,MAAW,EAAE,MAAW,EAAE,QAAa,EAAE,OAAe;IACrG,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAkC,CAAC;IACzD,IAAI,CAAC,IAAI,EAAE,CAA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CAAC,CAAC,MAAM,EAAE,EAAE;QACrC,MAAM,WAAW,GAAG,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;QAClD,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;IAEH,OAAO;QACN,SAAS,EAAE;YACV,eAAe;YACf,gBAAgB;SAChB;KACD,CAAC;AACH,CAAC"}
@@ -12,6 +12,9 @@ export async function preloadSceneScriptAsset(key, rootUrl, scene) {
12
12
  rootUrl: rootUrl,
13
13
  pluginExtension: ".babylon",
14
14
  });
15
+ scene.onDisposeObservable.addOnce(() => {
16
+ container.dispose();
17
+ });
15
18
  // Ensure all meshes perform their delay state check
16
19
  if (SceneLoaderFlags.ForceFullSceneLoadingForIncremental) {
17
20
  scene.meshes.forEach((m) => isMesh(m) && m._checkDelayState());
@@ -1 +1 @@
1
- {"version":3,"file":"scene.js","sourceRoot":"","sources":["../../../../../src/loading/script/preload/scene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,GAAW,EAAE,OAAe,EAAE,KAAY;IACvF,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IACxC,MAAM,oBAAoB,GAAG,KAAK,CAAC,oBAAoB,CAAC;IAExD,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG,CAAC;IACvC,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,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AuB;IACvB,MAAM,SAAS,GAAG,MAAM,uBAAuB,CAAC,aAAa,EAAE,KAAK,EAAE;QACrE,OAAO,EAAE,OAAO;QAChB,eAAe,EAAE,UAAU;KAC3B,CAAC,CAAC;IAEH,KAAK,CAAC,mBAAmB,CAAC,OAAO,CAAC,GAAG,EAAE;QACtC,SAAS,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,oDAAoD;IACpD,IAAI,gBAAgB,CAAC,mCAAmC,EAAE,CAAC;QAC1D,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,SAAS,CAAC,aAAa,EAAE,CAAC;IAE1B,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC;IAClC,KAAK,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IAElD,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAE/B,OAAO,SAAS,CAAC;AAClB,CAAC"}
@@ -28,6 +28,14 @@ export function registerScriptAssetParser(extension, parser) {
28
28
  */
29
29
  export async function _preloadScriptsAssets(rootUrl, scene, scriptsMap) {
30
30
  const nodes = [scene, ...scene.transformNodes, ...scene.meshes, ...scene.lights, ...scene.cameras];
31
+ let sceneAssetsCache = scriptAssetsCache.get(scene);
32
+ if (!sceneAssetsCache) {
33
+ sceneAssetsCache = new Map();
34
+ scriptAssetsCache.set(scene, sceneAssetsCache);
35
+ }
36
+ scene.onDisposeObservable.addOnce(() => {
37
+ scriptAssetsCache.delete(scene);
38
+ });
31
39
  const scriptNodes = nodes
32
40
  .filter((node) => node.metadata?.scripts?.length)
33
41
  .map((node) => node.metadata.scripts)
@@ -35,8 +43,8 @@ export async function _preloadScriptsAssets(rootUrl, scene, scriptsMap) {
35
43
  scriptNodes.forEach((script) => {
36
44
  const ctor = scriptsMap[script.key]?.default;
37
45
  ctor?._SceneAssets?.forEach((asset) => {
38
- if (!scriptAssetsCache.get(asset.sceneName)) {
39
- scriptAssetsCache.set(asset.sceneName, null);
46
+ if (!sceneAssetsCache.get(asset.sceneName)) {
47
+ sceneAssetsCache.set(asset.sceneName, null);
40
48
  }
41
49
  });
42
50
  if (script.values) {
@@ -45,14 +53,14 @@ export async function _preloadScriptsAssets(rootUrl, scene, scriptsMap) {
45
53
  continue;
46
54
  }
47
55
  const obj = script.values[key];
48
- if (obj.type === "asset" && obj.value && !scriptAssetsCache.get(obj.value)) {
49
- scriptAssetsCache.set(obj.value, null);
56
+ if (obj.type === "asset" && obj.value && !sceneAssetsCache.get(obj.value)) {
57
+ sceneAssetsCache.set(obj.value, null);
50
58
  }
51
59
  }
52
60
  }
53
61
  });
54
62
  let loadedAssetsCount = 0;
55
- for (const value of scriptAssetsCache.values()) {
63
+ for (const value of sceneAssetsCache.values()) {
56
64
  if (value === null) {
57
65
  ++loadedAssetsCount;
58
66
  }
@@ -61,8 +69,8 @@ export async function _preloadScriptsAssets(rootUrl, scene, scriptsMap) {
61
69
  return loadedAssetsCount;
62
70
  }
63
71
  const promises = [];
64
- scriptAssetsCache.forEach((_, key) => {
65
- if (scriptAssetsCache.get(key)) {
72
+ sceneAssetsCache.forEach((_, key) => {
73
+ if (sceneAssetsCache.get(key)) {
66
74
  return;
67
75
  }
68
76
  promises.push(new Promise(async (resolve) => {
@@ -73,18 +81,18 @@ export async function _preloadScriptsAssets(rootUrl, scene, scriptsMap) {
73
81
  const container = await preloadSceneScriptAsset(key, rootUrl, scene);
74
82
  scene.onDisposeObservable.addOnce(() => {
75
83
  container.dispose();
76
- scriptAssetsCache.delete(key);
84
+ sceneAssetsCache.delete(key);
77
85
  });
78
- scriptAssetsCache.set(key, new AdvancedAssetContainer(container, rootUrl, scriptsMap));
86
+ sceneAssetsCache.set(key, new AdvancedAssetContainer(container, rootUrl, scriptsMap));
79
87
  break;
80
88
  default:
81
89
  if (scriptAssetsParsers.has(extension)) {
82
90
  const parser = scriptAssetsParsers.get(extension);
83
- scriptAssetsCache.set(key, await parser({ key, rootUrl, scene }));
91
+ sceneAssetsCache.set(key, await parser({ key, rootUrl, scene }));
84
92
  break;
85
93
  }
86
94
  else {
87
- scriptAssetsCache.set(key, await preloadCommonScriptAsset(key, rootUrl));
95
+ sceneAssetsCache.set(key, await preloadCommonScriptAsset(key, rootUrl));
88
96
  }
89
97
  break;
90
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"preload.js","sourceRoot":"","sources":["../../../../src/loading/script/preload.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAe,CAAC;AAExD;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAA0E,CAAC;AAQrH;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,SAAiB,EAAE,MAAsE;IAClI,IAAI,mBAAmB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,+BAA+B,SAAS,mDAAmD,CAAC,CAAC;IAC3G,CAAC;IAED,mBAAmB,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAe,EAAE,KAAY,EAAE,UAAqB;IAC/F,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,cAAc,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IAEnG,MAAM,WAAW,GAA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wBACX,MAAM,SAAS,GAAG,MAAM,uBAAuB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;wBACrE,KAAK,CAAC,mBAAmB,CAAC,OAAO,CAAC,GAAG,EAAE;4BACtC,SAAS,CAAC,OAAO,EAAE,CAAC;4BACpB,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBAC9B,CAAC,CAAC,CAAC;wBAEH,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,sBAAsB,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;wBACtF,MAAM;oBAEP;wBACC,IAAI,mBAAmB,CAAC,GAAG,CAAC,SAAU,CAAC,EAAE,CAAC;4BACzC,MAAM,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC,SAAU,CAAE,CAAC;4BACpD,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;4BACjE,MAAM;wBACP,CAAC;6BAAM,CAAC;4BACP,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,wBAAwB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;wBACzE,CAAC;wBACD,MAAM;gBACR,CAAC;YACF,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACZ,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YAED,OAAO,EAAE,CAAC;QACX,CAAC,CAAC,CACF,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE5B,OAAO,iBAAiB,CAAC;AAC1B,CAAC"}
@@ -4,7 +4,7 @@ import { ScriptMap } from "../loader";
4
4
  * Defines the cache of all preloaded assets for scripts.
5
5
  * Used to populate decorated properties in scripts using @visibleAsAsset.
6
6
  */
7
- export declare const scriptAssetsCache: Map<string, any>;
7
+ export declare const scriptAssetsCache: Map<Scene, Map<string, any>>;
8
8
  /**
9
9
  * Defines the map of all parsers available to parse script assets.
10
10
  * Some assets may not be needed by the game directly such as navmeshes which require @recast-navigation packages to be included.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-editor-tools",
3
- "version": "5.5.1-alpha.1",
3
+ "version": "5.5.1-alpha.2",
4
4
  "description": "Babylon.js Editor Tools is a set of tools to help you create, edit and manage your Babylon.js scenes made using the Babylon.js Editor",
5
5
  "productName": "Babylon.js Editor Tools",
6
6
  "scripts": {