@splinetool/runtime 2.0.93 → 2.0.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/{runtime-DRACOLoader-GLMRFFK2.js → runtime-DRACOLoader-SDMMLQLV.js} +1 -1
- package/build/runtime-DRACOLoader-SDMMLQLV.js.br +0 -0
- package/build/runtime-DRACOLoader-SDMMLQLV.js.gz +0 -0
- package/build/{runtime-aiAssistant-5ECVEZLI.js → runtime-aiAssistant-MKZQ23BA.js} +1 -1
- package/build/runtime-aiAssistant-MKZQ23BA.js.br +0 -0
- package/build/runtime-aiAssistant-MKZQ23BA.js.gz +0 -0
- package/build/{runtime-apiServices-J4QEEJ2S.js → runtime-apiServices-YYNQCMLP.js} +1 -1
- package/build/runtime-apiServices-YYNQCMLP.js.br +0 -0
- package/build/runtime-apiServices-YYNQCMLP.js.gz +0 -0
- package/build/{runtime-audio-P56XBVSL.js → runtime-audio-GPQ4HYPM.js} +1 -1
- package/build/runtime-audio-GPQ4HYPM.js.br +0 -0
- package/build/runtime-audio-GPQ4HYPM.js.gz +0 -0
- package/build/{runtime-bloom-UG5HOSMH.js → runtime-bloom-UMJG5YKZ.js} +1 -1
- package/build/runtime-bloom-UMJG5YKZ.js.br +0 -0
- package/build/runtime-bloom-UMJG5YKZ.js.gz +0 -0
- package/build/{runtime-brightnessContrast-PGPHKJZX.js → runtime-brightnessContrast-LRDMKXC2.js} +1 -1
- package/build/runtime-brightnessContrast-LRDMKXC2.js.br +0 -0
- package/build/runtime-brightnessContrast-LRDMKXC2.js.gz +0 -0
- package/build/{runtime-chromaticAberration-T7XDMEVF.js → runtime-chromaticAberration-X46NQTBB.js} +1 -1
- package/build/runtime-chromaticAberration-X46NQTBB.js.br +0 -0
- package/build/runtime-chromaticAberration-X46NQTBB.js.gz +0 -0
- package/build/{runtime-chunk-BBD57YCP.js → runtime-chunk-32XVU5DS.js} +1 -1
- package/build/runtime-chunk-32XVU5DS.js.br +0 -0
- package/build/runtime-chunk-32XVU5DS.js.gz +0 -0
- package/build/{runtime-chunk-JKFC5GFF.js → runtime-chunk-33EF3BLM.js} +1 -1
- package/build/runtime-chunk-33EF3BLM.js.br +0 -0
- package/build/runtime-chunk-33EF3BLM.js.gz +0 -0
- package/build/runtime-chunk-3Q4J5ROW.js +1 -0
- package/build/runtime-chunk-3Q4J5ROW.js.br +0 -0
- package/build/runtime-chunk-3Q4J5ROW.js.gz +0 -0
- package/build/{runtime-chunk-OHSWHEBV.js → runtime-chunk-4Y4AXXPU.js} +1 -1
- package/build/runtime-chunk-4Y4AXXPU.js.br +0 -0
- package/build/runtime-chunk-4Y4AXXPU.js.gz +0 -0
- package/build/{runtime-chunk-QR32XGTY.js → runtime-chunk-AEPWABER.js} +1 -1
- package/build/runtime-chunk-AEPWABER.js.br +0 -0
- package/build/runtime-chunk-AEPWABER.js.gz +0 -0
- package/build/{runtime-chunk-CJAKEGOH.js → runtime-chunk-AU3CL3GR.js} +1 -1
- package/build/runtime-chunk-AU3CL3GR.js.br +0 -0
- package/build/runtime-chunk-AU3CL3GR.js.gz +0 -0
- package/build/{runtime-chunk-QSWZYIFB.js → runtime-chunk-BFGZJ4LR.js} +1 -1
- package/build/runtime-chunk-BFGZJ4LR.js.br +0 -0
- package/build/runtime-chunk-BFGZJ4LR.js.gz +0 -0
- package/build/{runtime-chunk-XA7NBHZC.js → runtime-chunk-D3OIGZUW.js} +1 -1
- package/build/runtime-chunk-D3OIGZUW.js.br +0 -0
- package/build/runtime-chunk-D3OIGZUW.js.gz +0 -0
- package/build/runtime-chunk-DCC352GL.js +1 -0
- package/build/runtime-chunk-DCC352GL.js.br +0 -0
- package/build/runtime-chunk-DCC352GL.js.gz +0 -0
- package/build/runtime-chunk-E4UNJ4TR.js +1 -0
- package/build/runtime-chunk-E4UNJ4TR.js.br +0 -0
- package/build/runtime-chunk-E4UNJ4TR.js.gz +0 -0
- package/build/{runtime-chunk-QE3AQ5FK.js → runtime-chunk-EEVK6AD6.js} +1 -1
- package/build/runtime-chunk-EEVK6AD6.js.br +0 -0
- package/build/runtime-chunk-EEVK6AD6.js.gz +0 -0
- package/build/{runtime-chunk-KHCWX7UM.js → runtime-chunk-F6XTFQMZ.js} +1 -1
- package/build/runtime-chunk-F6XTFQMZ.js.br +0 -0
- package/build/runtime-chunk-F6XTFQMZ.js.gz +0 -0
- package/build/{runtime-chunk-HBZCKQBD.js → runtime-chunk-FZVL5H67.js} +1 -1
- package/build/runtime-chunk-FZVL5H67.js.br +0 -0
- package/build/runtime-chunk-FZVL5H67.js.gz +0 -0
- package/build/{runtime-chunk-WWCXHYAF.js → runtime-chunk-GD4SGFHZ.js} +1 -1
- package/build/{runtime-chunk-WWCXHYAF.js.br → runtime-chunk-GD4SGFHZ.js.br} +0 -0
- package/build/runtime-chunk-GD4SGFHZ.js.gz +0 -0
- package/build/{runtime-chunk-OBAIF634.js → runtime-chunk-GSKBI4RN.js} +1 -1
- package/build/runtime-chunk-GSKBI4RN.js.br +0 -0
- package/build/runtime-chunk-GSKBI4RN.js.gz +0 -0
- package/build/{runtime-chunk-TXYV34UR.js → runtime-chunk-HGPSGN65.js} +1 -1
- package/build/runtime-chunk-HGPSGN65.js.br +2 -0
- package/build/runtime-chunk-HGPSGN65.js.gz +0 -0
- package/build/runtime-chunk-HOOQDTK7.js +1 -0
- package/build/runtime-chunk-HOOQDTK7.js.br +0 -0
- package/build/runtime-chunk-HOOQDTK7.js.gz +0 -0
- package/build/{runtime-chunk-CDN5RLZC.js → runtime-chunk-IBVB6UVI.js} +1 -1
- package/build/runtime-chunk-IBVB6UVI.js.br +0 -0
- package/build/runtime-chunk-IBVB6UVI.js.gz +0 -0
- package/build/{runtime-chunk-VQPMRUIZ.js → runtime-chunk-JABQRWT5.js} +1 -1
- package/build/runtime-chunk-JABQRWT5.js.br +0 -0
- package/build/runtime-chunk-JABQRWT5.js.gz +0 -0
- package/build/runtime-chunk-JJVEXKEO.js +1 -0
- package/build/runtime-chunk-JJVEXKEO.js.br +0 -0
- package/build/runtime-chunk-JJVEXKEO.js.gz +0 -0
- package/build/{runtime-chunk-VUJSHZTK.js → runtime-chunk-JTXN6DIH.js} +1 -1
- package/build/runtime-chunk-JTXN6DIH.js.br +0 -0
- package/build/runtime-chunk-JTXN6DIH.js.gz +0 -0
- package/build/{runtime-chunk-KK7BC667.js → runtime-chunk-KJQWLDYH.js} +1 -1
- package/build/runtime-chunk-KJQWLDYH.js.br +0 -0
- package/build/runtime-chunk-KJQWLDYH.js.gz +0 -0
- package/build/runtime-chunk-KPOUV3HD.js +1 -0
- package/build/runtime-chunk-KPOUV3HD.js.br +0 -0
- package/build/runtime-chunk-KPOUV3HD.js.gz +0 -0
- package/build/{runtime-chunk-54KAQGZU.js → runtime-chunk-KQTC7OLV.js} +1 -1
- package/build/runtime-chunk-KQTC7OLV.js.br +0 -0
- package/build/runtime-chunk-KQTC7OLV.js.gz +0 -0
- package/build/{runtime-chunk-W34CWO4J.js → runtime-chunk-PF6YNLMZ.js} +1 -1
- package/build/runtime-chunk-PF6YNLMZ.js.br +0 -0
- package/build/runtime-chunk-PF6YNLMZ.js.gz +0 -0
- package/build/{runtime-chunk-K6UEJGDM.js → runtime-chunk-PWMK5MVJ.js} +1 -1
- package/build/runtime-chunk-PWMK5MVJ.js.br +0 -0
- package/build/runtime-chunk-PWMK5MVJ.js.gz +0 -0
- package/build/runtime-chunk-QJMMF3L2.js +1 -0
- package/build/runtime-chunk-QJMMF3L2.js.br +0 -0
- package/build/runtime-chunk-QJMMF3L2.js.gz +0 -0
- package/build/{runtime-chunk-LZSX7T4B.js → runtime-chunk-REXAQKUN.js} +1 -1
- package/build/runtime-chunk-REXAQKUN.js.br +0 -0
- package/build/runtime-chunk-REXAQKUN.js.gz +0 -0
- package/build/{runtime-chunk-WCJY5BE7.js → runtime-chunk-RWYT7G6G.js} +1 -1
- package/build/runtime-chunk-RWYT7G6G.js.br +0 -0
- package/build/runtime-chunk-RWYT7G6G.js.gz +0 -0
- package/build/{runtime-chunk-PI5WT5IX.js → runtime-chunk-WYIK4MJQ.js} +1 -1
- package/build/runtime-chunk-WYIK4MJQ.js.br +0 -0
- package/build/runtime-chunk-WYIK4MJQ.js.gz +0 -0
- package/build/runtime-chunk-ZA3HZGIR.js +1 -0
- package/build/runtime-chunk-ZA3HZGIR.js.br +0 -0
- package/build/runtime-chunk-ZA3HZGIR.js.gz +0 -0
- package/build/{runtime-chunk-6TZS7SVL.js → runtime-chunk-ZFM73G2B.js} +1 -1
- package/build/runtime-chunk-ZFM73G2B.js.br +0 -0
- package/build/runtime-chunk-ZFM73G2B.js.gz +0 -0
- package/build/{runtime-chunk-JH5Z7VPK.js → runtime-chunk-ZJIYRGBK.js} +1 -1
- package/build/runtime-chunk-ZJIYRGBK.js.br +0 -0
- package/build/runtime-chunk-ZJIYRGBK.js.gz +0 -0
- package/build/{runtime-classicRuntime-L7QG2FJ5.js → runtime-classicRuntime-WIJ56CKR.js} +1 -1
- package/build/runtime-classicRuntime-WIJ56CKR.js.br +0 -0
- package/build/runtime-classicRuntime-WIJ56CKR.js.gz +0 -0
- package/build/runtime-cloners-2S7SALQM.js +1 -0
- package/build/runtime-cloners-2S7SALQM.js.br +1 -0
- package/build/runtime-cloners-2S7SALQM.js.gz +0 -0
- package/build/{runtime-collisionBVH-CQUE6RZV.js → runtime-collisionBVH-JA4BEOA7.js} +1 -1
- package/build/runtime-collisionBVH-JA4BEOA7.js.br +0 -0
- package/build/runtime-collisionBVH-JA4BEOA7.js.gz +0 -0
- package/build/{runtime-components-SNSQPVIU.js → runtime-components-3T3QMQUH.js} +1 -1
- package/build/runtime-components-3T3QMQUH.js.br +0 -0
- package/build/runtime-components-3T3QMQUH.js.gz +0 -0
- package/build/{runtime-conditional-SK6JLPTN.js → runtime-conditional-CCGDVDMD.js} +1 -1
- package/build/runtime-conditional-CCGDVDMD.js.br +0 -0
- package/build/runtime-conditional-CCGDVDMD.js.gz +0 -0
- package/build/{runtime-createDestroy-7JLV5ONP.js → runtime-createDestroy-W6FF4RAP.js} +1 -1
- package/build/runtime-createDestroy-W6FF4RAP.js.br +0 -0
- package/build/runtime-createDestroy-W6FF4RAP.js.gz +0 -0
- package/build/{runtime-depthOfField-WIDZIOIS.js → runtime-depthOfField-DSE6YVZ4.js} +1 -1
- package/build/runtime-depthOfField-DSE6YVZ4.js.br +0 -0
- package/build/runtime-depthOfField-DSE6YVZ4.js.gz +0 -0
- package/build/{runtime-dragDrop-74DNBQ4A.js → runtime-dragDrop-2TMWDGUQ.js} +1 -1
- package/build/runtime-dragDrop-2TMWDGUQ.js.br +0 -0
- package/build/runtime-dragDrop-2TMWDGUQ.js.gz +0 -0
- package/build/{runtime-fxBloom-4HSWHGBL.js → runtime-fxBloom-4HB5FTK3.js} +1 -1
- package/build/runtime-fxBloom-4HB5FTK3.js.br +0 -0
- package/build/runtime-fxBloom-4HB5FTK3.js.gz +0 -0
- package/build/{runtime-fxDepthOfField-NGC6SATF.js → runtime-fxDepthOfField-URCQCIRP.js} +1 -1
- package/build/runtime-fxDepthOfField-URCQCIRP.js.br +0 -0
- package/build/runtime-fxDepthOfField-URCQCIRP.js.gz +0 -0
- package/build/{runtime-gameControls-HMLU4O4P.js → runtime-gameControls-VAUAOGUW.js} +1 -1
- package/build/runtime-gameControls-VAUAOGUW.js.br +0 -0
- package/build/runtime-gameControls-VAUAOGUW.js.gz +0 -0
- package/build/runtime-hair-NLGIEVG3.js +1 -0
- package/build/runtime-hair-NLGIEVG3.js.br +1 -0
- package/build/runtime-hair-NLGIEVG3.js.gz +0 -0
- package/build/{runtime-hueSaturation-7HSYL7M5.js → runtime-hueSaturation-TZ5VQY72.js} +1 -1
- package/build/runtime-hueSaturation-TZ5VQY72.js.br +0 -0
- package/build/runtime-hueSaturation-TZ5VQY72.js.gz +0 -0
- package/build/{runtime-mergeStaticGeometries-4TLAKDAM.js → runtime-mergeStaticGeometries-K2YJKZ3C.js} +1 -1
- package/build/runtime-mergeStaticGeometries-K2YJKZ3C.js.br +0 -0
- package/build/runtime-mergeStaticGeometries-K2YJKZ3C.js.gz +0 -0
- package/build/{runtime-miscActions-YT3JTCAS.js → runtime-miscActions-6CUG2JSF.js} +1 -1
- package/build/runtime-miscActions-6CUG2JSF.js.br +0 -0
- package/build/runtime-miscActions-6CUG2JSF.js.gz +0 -0
- package/build/{runtime-mouseHover-UC4V64KR.js → runtime-mouseHover-CYCSNNZM.js} +1 -1
- package/build/runtime-mouseHover-CYCSNNZM.js.br +0 -0
- package/build/runtime-mouseHover-CYCSNNZM.js.gz +0 -0
- package/build/{runtime-noise-PPEDFDYO.js → runtime-noise-FLMWYKTL.js} +1 -1
- package/build/runtime-noise-FLMWYKTL.js.br +0 -0
- package/build/runtime-noise-FLMWYKTL.js.gz +0 -0
- package/build/{runtime-particles-KRZTDOJK.js → runtime-particles-PDPG5E74.js} +1 -1
- package/build/runtime-particles-PDPG5E74.js.br +0 -0
- package/build/runtime-particles-PDPG5E74.js.gz +0 -0
- package/build/{runtime-paths-4EGJEH3U.js → runtime-paths-E4GHUGNN.js} +1 -1
- package/build/runtime-paths-E4GHUGNN.js.br +0 -0
- package/build/runtime-paths-E4GHUGNN.js.gz +0 -0
- package/build/{runtime-pixelation-MVG6XLP3.js → runtime-pixelation-AOFGI5XX.js} +1 -1
- package/build/runtime-pixelation-AOFGI5XX.js.br +0 -0
- package/build/runtime-pixelation-AOFGI5XX.js.gz +0 -0
- package/build/{runtime-resize-72IGTMAR.js → runtime-resize-DAWD3MKG.js} +1 -1
- package/build/runtime-resize-DAWD3MKG.js.br +0 -0
- package/build/runtime-resize-DAWD3MKG.js.gz +0 -0
- package/build/{runtime-sceneTransition-55XY2MUR.js → runtime-sceneTransition-SFGBWSP3.js} +1 -1
- package/build/runtime-sceneTransition-SFGBWSP3.js.br +0 -0
- package/build/runtime-sceneTransition-SFGBWSP3.js.gz +0 -0
- package/build/{runtime-scroll-M6OD2EFE.js → runtime-scroll-HKLPDE7E.js} +1 -1
- package/build/runtime-scroll-HKLPDE7E.js.br +0 -0
- package/build/runtime-scroll-HKLPDE7E.js.gz +0 -0
- package/build/runtime-shapeBlends-COFJFXT6.js +1 -0
- package/build/runtime-shapeBlends-COFJFXT6.js.br +2 -0
- package/build/runtime-shapeBlends-COFJFXT6.js.gz +0 -0
- package/build/{runtime-text-4LC7VC5F.js → runtime-text-NQU4F3KI.js} +1 -1
- package/build/runtime-text-NQU4F3KI.js.br +0 -0
- package/build/runtime-text-NQU4F3KI.js.gz +0 -0
- package/build/{runtime-textInputs-YSSB35BQ.js → runtime-textInputs-5WG7OPGO.js} +1 -1
- package/build/runtime-textInputs-5WG7OPGO.js.br +0 -0
- package/build/runtime-textInputs-5WG7OPGO.js.gz +0 -0
- package/build/{runtime-timeline-EWF2TRMQ.js → runtime-timeline-EAC5OJEK.js} +1 -1
- package/build/runtime-timeline-EAC5OJEK.js.br +0 -0
- package/build/runtime-timeline-EAC5OJEK.js.gz +0 -0
- package/build/{runtime-tracking-ZRIG4OD6.js → runtime-tracking-6CN7PQFK.js} +1 -1
- package/build/runtime-tracking-6CN7PQFK.js.br +0 -0
- package/build/runtime-tracking-6CN7PQFK.js.gz +0 -0
- package/build/{runtime-transitions-CTFNET4C.js → runtime-transitions-N47Y4AXH.js} +1 -1
- package/build/runtime-transitions-N47Y4AXH.js.br +0 -0
- package/build/runtime-transitions-N47Y4AXH.js.gz +0 -0
- package/build/{runtime-ui2d-ACT52A4B.js → runtime-ui2d-T3OZFBOE.js} +1 -1
- package/build/runtime-ui2d-T3OZFBOE.js.br +0 -0
- package/build/runtime-ui2d-T3OZFBOE.js.gz +0 -0
- package/build/{runtime-updater-RCOMZLTB.js → runtime-updater-6YEO4WI3.js} +1 -1
- package/build/runtime-updater-6YEO4WI3.js.br +2 -0
- package/build/runtime-updater-6YEO4WI3.js.gz +0 -0
- package/build/{runtime-variables-DJUQPZDB.js → runtime-variables-ICLL7DZV.js} +1 -1
- package/build/runtime-variables-ICLL7DZV.js.br +0 -0
- package/build/runtime-variables-ICLL7DZV.js.gz +0 -0
- package/build/{runtime-vectorShapes-RYMOTNNM.js → runtime-vectorShapes-4MX2X2MH.js} +1 -1
- package/build/runtime-vectorShapes-4MX2X2MH.js.br +0 -0
- package/build/runtime-vectorShapes-4MX2X2MH.js.gz +0 -0
- package/build/{runtime-video-U5RS7HHJ.js → runtime-video-KFIFPA6P.js} +1 -1
- package/build/runtime-video-KFIFPA6P.js.br +0 -0
- package/build/runtime-video-KFIFPA6P.js.gz +0 -0
- package/build/{runtime-vignette-KYH2SCOD.js → runtime-vignette-S4Z7IMQ5.js} +1 -1
- package/build/runtime-vignette-S4Z7IMQ5.js.br +0 -0
- package/build/runtime-vignette-S4Z7IMQ5.js.gz +0 -0
- package/build/runtime-webgpu-JZZF7PVG.js +1 -0
- package/build/runtime-webgpu-JZZF7PVG.js.br +0 -0
- package/build/runtime-webgpu-JZZF7PVG.js.gz +0 -0
- package/build/runtime.cjs +16 -8
- package/build/runtime.js +1 -1
- package/build/runtime.js.br +0 -0
- package/build/runtime.js.gz +0 -0
- package/build/runtime.standalone.js +1 -1
- package/build/runtime.standalone.js.br +0 -0
- package/build/runtime.standalone.js.gz +0 -0
- package/build/runtime.standalone.webgl.js +1 -1
- package/build/runtime.standalone.webgl.js.br +0 -0
- package/build/runtime.standalone.webgl.js.gz +0 -0
- package/build/runtime.standalone.webgpu.js +1 -1
- package/build/runtime.standalone.webgpu.js.br +0 -0
- package/build/runtime.standalone.webgpu.js.gz +0 -0
- package/build/runtime.standalone.webgpu.micro.js +1 -1
- package/build/runtime.standalone.webgpu.micro.js.br +0 -0
- package/build/runtime.standalone.webgpu.micro.js.gz +0 -0
- package/build/runtime.standalone.webgpu.min.js +1 -1
- package/build/runtime.standalone.webgpu.min.js.br +0 -0
- package/build/runtime.standalone.webgpu.min.js.gz +0 -0
- package/package.json +1 -1
- package/build/runtime-DRACOLoader-GLMRFFK2.js.br +0 -0
- package/build/runtime-DRACOLoader-GLMRFFK2.js.gz +0 -0
- package/build/runtime-aiAssistant-5ECVEZLI.js.br +0 -0
- package/build/runtime-aiAssistant-5ECVEZLI.js.gz +0 -0
- package/build/runtime-apiServices-J4QEEJ2S.js.br +0 -0
- package/build/runtime-apiServices-J4QEEJ2S.js.gz +0 -0
- package/build/runtime-audio-P56XBVSL.js.br +0 -7
- package/build/runtime-audio-P56XBVSL.js.gz +0 -0
- package/build/runtime-bloom-UG5HOSMH.js.br +0 -0
- package/build/runtime-bloom-UG5HOSMH.js.gz +0 -0
- package/build/runtime-brightnessContrast-PGPHKJZX.js.br +0 -0
- package/build/runtime-brightnessContrast-PGPHKJZX.js.gz +0 -0
- package/build/runtime-chromaticAberration-T7XDMEVF.js.br +0 -0
- package/build/runtime-chromaticAberration-T7XDMEVF.js.gz +0 -0
- package/build/runtime-chunk-54KAQGZU.js.br +0 -0
- package/build/runtime-chunk-54KAQGZU.js.gz +0 -0
- package/build/runtime-chunk-5WJTDAAI.js +0 -1
- package/build/runtime-chunk-5WJTDAAI.js.br +0 -0
- package/build/runtime-chunk-5WJTDAAI.js.gz +0 -0
- package/build/runtime-chunk-6FFBLDZX.js +0 -1
- package/build/runtime-chunk-6FFBLDZX.js.br +0 -0
- package/build/runtime-chunk-6FFBLDZX.js.gz +0 -0
- package/build/runtime-chunk-6TZS7SVL.js.br +0 -0
- package/build/runtime-chunk-6TZS7SVL.js.gz +0 -0
- package/build/runtime-chunk-7CHUIB5Q.js +0 -1
- package/build/runtime-chunk-7CHUIB5Q.js.br +0 -0
- package/build/runtime-chunk-7CHUIB5Q.js.gz +0 -0
- package/build/runtime-chunk-BBD57YCP.js.br +0 -0
- package/build/runtime-chunk-BBD57YCP.js.gz +0 -0
- package/build/runtime-chunk-BVVSZMXD.js +0 -1
- package/build/runtime-chunk-BVVSZMXD.js.br +0 -0
- package/build/runtime-chunk-BVVSZMXD.js.gz +0 -0
- package/build/runtime-chunk-CDN5RLZC.js.br +0 -0
- package/build/runtime-chunk-CDN5RLZC.js.gz +0 -0
- package/build/runtime-chunk-CJAKEGOH.js.br +0 -0
- package/build/runtime-chunk-CJAKEGOH.js.gz +0 -0
- package/build/runtime-chunk-GF2HB4HZ.js +0 -1
- package/build/runtime-chunk-GF2HB4HZ.js.br +0 -0
- package/build/runtime-chunk-GF2HB4HZ.js.gz +0 -0
- package/build/runtime-chunk-HBZCKQBD.js.br +0 -0
- package/build/runtime-chunk-HBZCKQBD.js.gz +0 -0
- package/build/runtime-chunk-JH5Z7VPK.js.br +0 -0
- package/build/runtime-chunk-JH5Z7VPK.js.gz +0 -0
- package/build/runtime-chunk-JKFC5GFF.js.br +0 -0
- package/build/runtime-chunk-JKFC5GFF.js.gz +0 -0
- package/build/runtime-chunk-K6UEJGDM.js.br +0 -0
- package/build/runtime-chunk-K6UEJGDM.js.gz +0 -0
- package/build/runtime-chunk-KHCWX7UM.js.br +0 -0
- package/build/runtime-chunk-KHCWX7UM.js.gz +0 -0
- package/build/runtime-chunk-KK7BC667.js.br +0 -0
- package/build/runtime-chunk-KK7BC667.js.gz +0 -0
- package/build/runtime-chunk-LZSX7T4B.js.br +0 -0
- package/build/runtime-chunk-LZSX7T4B.js.gz +0 -0
- package/build/runtime-chunk-NEKALYDS.js +0 -1
- package/build/runtime-chunk-NEKALYDS.js.br +0 -0
- package/build/runtime-chunk-NEKALYDS.js.gz +0 -0
- package/build/runtime-chunk-OBAIF634.js.br +0 -0
- package/build/runtime-chunk-OBAIF634.js.gz +0 -0
- package/build/runtime-chunk-OHSWHEBV.js.br +0 -0
- package/build/runtime-chunk-OHSWHEBV.js.gz +0 -0
- package/build/runtime-chunk-PI5WT5IX.js.br +0 -0
- package/build/runtime-chunk-PI5WT5IX.js.gz +0 -0
- package/build/runtime-chunk-QE3AQ5FK.js.br +0 -0
- package/build/runtime-chunk-QE3AQ5FK.js.gz +0 -0
- package/build/runtime-chunk-QR32XGTY.js.br +0 -0
- package/build/runtime-chunk-QR32XGTY.js.gz +0 -0
- package/build/runtime-chunk-QSWZYIFB.js.br +0 -0
- package/build/runtime-chunk-QSWZYIFB.js.gz +0 -0
- package/build/runtime-chunk-TXYV34UR.js.br +0 -0
- package/build/runtime-chunk-TXYV34UR.js.gz +0 -0
- package/build/runtime-chunk-VQPMRUIZ.js.br +0 -0
- package/build/runtime-chunk-VQPMRUIZ.js.gz +0 -0
- package/build/runtime-chunk-VUJSHZTK.js.br +0 -0
- package/build/runtime-chunk-VUJSHZTK.js.gz +0 -0
- package/build/runtime-chunk-VXU3S3Y3.js +0 -1
- package/build/runtime-chunk-VXU3S3Y3.js.br +0 -0
- package/build/runtime-chunk-VXU3S3Y3.js.gz +0 -0
- package/build/runtime-chunk-W34CWO4J.js.br +0 -0
- package/build/runtime-chunk-W34CWO4J.js.gz +0 -0
- package/build/runtime-chunk-WCJY5BE7.js.br +0 -0
- package/build/runtime-chunk-WCJY5BE7.js.gz +0 -0
- package/build/runtime-chunk-WWCXHYAF.js.gz +0 -0
- package/build/runtime-chunk-WWIPBG3J.js +0 -1
- package/build/runtime-chunk-WWIPBG3J.js.br +0 -0
- package/build/runtime-chunk-WWIPBG3J.js.gz +0 -0
- package/build/runtime-chunk-XA7NBHZC.js.br +0 -0
- package/build/runtime-chunk-XA7NBHZC.js.gz +0 -0
- package/build/runtime-classicRuntime-L7QG2FJ5.js.br +0 -0
- package/build/runtime-classicRuntime-L7QG2FJ5.js.gz +0 -0
- package/build/runtime-cloners-KG6N3BXV.js +0 -1
- package/build/runtime-cloners-KG6N3BXV.js.br +0 -0
- package/build/runtime-cloners-KG6N3BXV.js.gz +0 -0
- package/build/runtime-collisionBVH-CQUE6RZV.js.br +0 -0
- package/build/runtime-collisionBVH-CQUE6RZV.js.gz +0 -0
- package/build/runtime-components-SNSQPVIU.js.br +0 -0
- package/build/runtime-components-SNSQPVIU.js.gz +0 -0
- package/build/runtime-conditional-SK6JLPTN.js.br +0 -0
- package/build/runtime-conditional-SK6JLPTN.js.gz +0 -0
- package/build/runtime-createDestroy-7JLV5ONP.js.br +0 -0
- package/build/runtime-createDestroy-7JLV5ONP.js.gz +0 -0
- package/build/runtime-depthOfField-WIDZIOIS.js.br +0 -0
- package/build/runtime-depthOfField-WIDZIOIS.js.gz +0 -0
- package/build/runtime-dragDrop-74DNBQ4A.js.br +0 -0
- package/build/runtime-dragDrop-74DNBQ4A.js.gz +0 -0
- package/build/runtime-fxBloom-4HSWHGBL.js.br +0 -0
- package/build/runtime-fxBloom-4HSWHGBL.js.gz +0 -0
- package/build/runtime-fxDepthOfField-NGC6SATF.js.br +0 -0
- package/build/runtime-fxDepthOfField-NGC6SATF.js.gz +0 -0
- package/build/runtime-gameControls-HMLU4O4P.js.br +0 -0
- package/build/runtime-gameControls-HMLU4O4P.js.gz +0 -0
- package/build/runtime-hair-JWEUOSZQ.js +0 -1
- package/build/runtime-hair-JWEUOSZQ.js.br +0 -2
- package/build/runtime-hair-JWEUOSZQ.js.gz +0 -0
- package/build/runtime-hueSaturation-7HSYL7M5.js.br +0 -0
- package/build/runtime-hueSaturation-7HSYL7M5.js.gz +0 -0
- package/build/runtime-mergeStaticGeometries-4TLAKDAM.js.br +0 -0
- package/build/runtime-mergeStaticGeometries-4TLAKDAM.js.gz +0 -0
- package/build/runtime-miscActions-YT3JTCAS.js.br +0 -0
- package/build/runtime-miscActions-YT3JTCAS.js.gz +0 -0
- package/build/runtime-mouseHover-UC4V64KR.js.br +0 -0
- package/build/runtime-mouseHover-UC4V64KR.js.gz +0 -0
- package/build/runtime-noise-PPEDFDYO.js.br +0 -0
- package/build/runtime-noise-PPEDFDYO.js.gz +0 -0
- package/build/runtime-particles-KRZTDOJK.js.br +0 -0
- package/build/runtime-particles-KRZTDOJK.js.gz +0 -0
- package/build/runtime-paths-4EGJEH3U.js.br +0 -0
- package/build/runtime-paths-4EGJEH3U.js.gz +0 -0
- package/build/runtime-pixelation-MVG6XLP3.js.br +0 -0
- package/build/runtime-pixelation-MVG6XLP3.js.gz +0 -0
- package/build/runtime-resize-72IGTMAR.js.br +0 -0
- package/build/runtime-resize-72IGTMAR.js.gz +0 -0
- package/build/runtime-sceneTransition-55XY2MUR.js.br +0 -0
- package/build/runtime-sceneTransition-55XY2MUR.js.gz +0 -0
- package/build/runtime-scroll-M6OD2EFE.js.br +0 -0
- package/build/runtime-scroll-M6OD2EFE.js.gz +0 -0
- package/build/runtime-shapeBlends-2QP6U25O.js +0 -1
- package/build/runtime-shapeBlends-2QP6U25O.js.br +0 -4
- package/build/runtime-shapeBlends-2QP6U25O.js.gz +0 -0
- package/build/runtime-text-4LC7VC5F.js.br +0 -0
- package/build/runtime-text-4LC7VC5F.js.gz +0 -0
- package/build/runtime-textInputs-YSSB35BQ.js.br +0 -0
- package/build/runtime-textInputs-YSSB35BQ.js.gz +0 -0
- package/build/runtime-timeline-EWF2TRMQ.js.br +0 -0
- package/build/runtime-timeline-EWF2TRMQ.js.gz +0 -0
- package/build/runtime-tracking-ZRIG4OD6.js.br +0 -0
- package/build/runtime-tracking-ZRIG4OD6.js.gz +0 -0
- package/build/runtime-transitions-CTFNET4C.js.br +0 -0
- package/build/runtime-transitions-CTFNET4C.js.gz +0 -0
- package/build/runtime-ui2d-ACT52A4B.js.br +0 -0
- package/build/runtime-ui2d-ACT52A4B.js.gz +0 -0
- package/build/runtime-updater-RCOMZLTB.js.br +0 -3
- package/build/runtime-updater-RCOMZLTB.js.gz +0 -0
- package/build/runtime-variables-DJUQPZDB.js.br +0 -0
- package/build/runtime-variables-DJUQPZDB.js.gz +0 -0
- package/build/runtime-vectorShapes-RYMOTNNM.js.br +0 -0
- package/build/runtime-vectorShapes-RYMOTNNM.js.gz +0 -0
- package/build/runtime-video-U5RS7HHJ.js.br +0 -0
- package/build/runtime-video-U5RS7HHJ.js.gz +0 -0
- package/build/runtime-vignette-KYH2SCOD.js.br +0 -0
- package/build/runtime-vignette-KYH2SCOD.js.gz +0 -0
- package/build/runtime-webgpu-GP4ESV4Z.js +0 -1
- package/build/runtime-webgpu-GP4ESV4Z.js.br +0 -0
- package/build/runtime-webgpu-GP4ESV4Z.js.gz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t}from"./runtime-chunk-GF2HB4HZ.js";import{a as e,b as a}from"./runtime-chunk-DZNU62CT.js";import{a as i}from"./runtime-chunk-VAVYZ35B.js";import"./runtime-chunk-FQNSP44B.js";import{h as r}from"./runtime-chunk-KK7BC667.js";import"./runtime-chunk-WCJY5BE7.js";import{g as o}from"./runtime-chunk-QR32XGTY.js";import"./runtime-chunk-TU4KDRKR.js";import"./runtime-chunk-6FFBLDZX.js";import"./runtime-chunk-K6UEJGDM.js";import"./runtime-chunk-6TZS7SVL.js";import"./runtime-chunk-WWIPBG3J.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{f as n,g as s}from"./runtime-chunk-JKFC5GFF.js";import{h as c,v as h}from"./runtime-chunk-PI5WT5IX.js";import"./runtime-chunk-RTLL6WIB.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-QSWZYIFB.js";import{a as d}from"./runtime-chunk-TZCHGFVF.js";import{Qa as p}from"./runtime-chunk-KHCWX7UM.js";import{Ec as l,Fc as v,Gc as u,Oc as m,rd as g}from"./runtime-chunk-BVVSZMXD.js";import"./runtime-chunk-ML3Z74BL.js";var E=new v,f=new v,D=new v,y=new g,b=new v,x=new v,C=new v,j=new l,M=(new m,new u),P=new v,T=new v,w=.2;function I(t,e){!e||(e[0]<e[1]&&(t.x=Math.min(Math.max(t.x,e[0]),e[1])),e[2]<e[3]&&(t.y=Math.min(Math.max(t.y,e[2]),e[3])),e[4]<e[5]&&(t.z=Math.min(Math.max(t.z,e[4]),e[5])))}var S=function(){let t=new m;return(e,a,i)=>{let n=e.obj;n.parent instanceof r?t.identity():t.copy(n.parent.matrixWorld),t.invert(),n.position.copy(a),"global"===e.reference&&I(n.position,e.limits),n.position.applyMatrix4(t),"parent"===e.reference?I(n.position,e.limits):"local"===e.reference&&(j.copy(e.quat0).invert(),n.position.sub(e.position0),n.position.applyQuaternion(j),I(n.position,e.limits),j.invert(),n.position.applyQuaternion(j),n.position.add(e.position0)),t.multiply(i??n.matrixWorld),p(t,{quaternion:n.quaternion}),n.updateMatrix(),n.updateMatrixWorld(),n.hasNonUniformScale&&n.updateMatrixWorldRigid(),n instanceof h&&o(n.parent)&&n.invalidateDownstreamBooleanData(!0)}}(),F=class{constructor(t,e,a,i,r,o,s){this.object=t,this.id=e,this.data=a,this.dropDestIds=[],this.activeIdx=null,this.wasDragEventTriggered=!1,this.resetDampingFactor=0===this.data.resetSpeed?1:8/this.data.resetSpeed+1,this.snapDampingFactor=0===this.data.snapSpeed?1:8/this.data.snapSpeed+1,this.actionsDrag=n(a,a.dragDropActions.drag,i,r,o,this.object),this.actionsDrop=n(a,a.dragDropActions.drop,i,r,o,this.object);let c=[];this.data.objects.forEach(t=>{let e=i.find(t);!e||!1!==e.data.visible&&(c.push(e),s[e.uuid]&&s[e.uuid].forEach(t=>{let e=i.find(t);!e||!1!==e.data.visible&&c.push(e)}))}),this.data.dropDestinations.forEach(t=>{let e=i.find(t);!e||!1!==e.data.visible&&(this.dropDestIds.push(e.uuid),s[e.uuid]&&s[e.uuid].forEach(t=>{let e=i.find(t);!e||!1!==e.data.visible&&this.dropDestIds.push(e.uuid)}))}),this.dragItems=c.map(t=>("locked"===this.data.planeMode&&(t.userData.lockedPlane=!0),t.userData.worldPosition0=(new v).setFromMatrixPosition(t.matrixWorld),{obj:t,fromPosition:(new v).setFromMatrixPosition(t.matrixWorld),pointStart:new v,pointEnd:new v,paused:!0,currentDampingFactor:this.data.dampingFactor,reset:!1,position0:(new v).copy(t.position),quat0:(new l).copy(t.quaternion),snapped:!1,orientationMatrix:new m,limits:this.data.limits,reference:this.data.referenceFrame}))}get activeDragItem(){return null!==this.activeIdx?this.dragItems[this.activeIdx]:null}dispose(){s(this.actionsDrag),s(this.actionsDrop),this.dragItems.forEach(t=>{t.fromPosition.copy(t.obj.userData.worldPosition0),t.pointStart.copy(t.fromPosition),t.pointEnd.copy(t.pointStart),t.obj.recursiveBBoxNeedsUpdate=!0,t.obj.userData.lockedPlane=void 0,t.obj.position.copy(t.position0),t.obj.quaternion.copy(t.quat0),t.obj.updateMatrix()})}},k=class extends e{constructor(e,a){super(e),this.eventManager=a,this.events=[],this.lastDropDestination=null,this.dragTimeout=null,this.lastCursorRaycastTime=0,this.trailingCursorTimer=null,this.trailingCursorEvent=null,this.onPointerDown=t=>{if(i.length>1)return;this.eventContext.updateRaycaster(t);let{raycaster:e,page:a}=this.eventContext,r=a.raycastWithClones(e);if(this.lastDropDestination=null,0!==r.length){for(let t of this.events){let e=0;for(let{obj:a,pointEnd:i,pointStart:o}of t.dragItems){if(a===r[0].object||a===r[0].object.object||c.is(a)&&a.isAncestorOf(r[0].object.uuid)){if(t.activeIdx=e,t.activeDragItem.reset=!1,t.activeDragItem.currentDampingFactor=t.data.dampingFactor,t.activeDragItem.snapped=!1,"hand"===t.data.cursor&&this.setCursor("grabbing"),this.eventManager.controlsManager.usePhysics){t.activeDragItem.obj.rigidBody&&(t.activeDragItem.obj.rigidBody.setBodyType(2,!0),this.eventManager.controlsManager.sharedGameControlGlobals.kinematicBodyToEntity.set(t.activeDragItem.obj.rigidBody.handle,t.activeDragItem.obj));let e=t.activeDragItem.obj;a.hasNonUniformScale&&a.updateMatrixWorldRigid(),(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(b,j,x),void 0===e.prevQ?(e.prevQ=j.clone(),e.prevT=b.clone()):(e.prevQ.copy(j),e.prevT.copy(b)),this.eventManager.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.push(t.activeDragItem.obj)}return this.calcPlaneIntersectPos(a,o,t.data.plane,t.data.referenceFrame),i.copy(o),(this.eventManager.controlsManager.usePhysics&&"dynamic"===a.data.physics?.rigidBody||!1===t.data.drop||!1===t.data.resetOnSnapFail)&&t.activeDragItem.fromPosition.setFromMatrixPosition(t.activeDragItem.obj.matrixWorld),this.activeEvent=t,void(this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1))}e++}}this.activeEvent=null}else this.activeEvent=null},this.runTrailingCursorUpdate=()=>{this.trailingCursorTimer=null;let t=this.trailingCursorEvent;this.trailingCursorEvent=null,null!==t&&0===i.length&&(this.eventContext.updateRaycaster(t),this.lastCursorRaycastTime=performance.now(),this.updateCursorFromRaycast())},this.onPointerMove=e=>{if(i.length>1)return;this.eventContext.updateRaycaster(e);let{raycaster:a,page:r}=this.eventContext;if(0===i.length){if(!this.events.some(t=>"hand"===t.data.cursor||"move"===t.data.cursor))return;let t=performance.now();return t-this.lastCursorRaycastTime<16?(this.trailingCursorEvent=e,void(null===this.trailingCursorTimer&&(this.trailingCursorTimer=window.setTimeout(this.runTrailingCursorUpdate,32)))):(this.trailingCursorEvent=null,this.lastCursorRaycastTime=t,void this.updateCursorFromRaycast())}if(this.activeEvent&&this.activeEvent.activeDragItem){let e,i=this.activeEvent.activeDragItem;if(i.snapped=!1,this.activeEvent.data.drop&&(e=r.raycastWithClones(a).filter(e=>i.obj!==e.object&&!i.obj.isAncestorOf(e.object.uuid)&&!(e.object instanceof t)&&("all"===this.activeEvent.data.dropOn||this.activeEvent.dropDestIds.some(t=>t===e.object.uuid||r.scene.find(t).isAncestorOf(e.object.uuid))))[0]),e){let t=C.copy(e.face.normal).applyMatrix3(M.getNormalMatrix(e.object.matrixWorld));if("center"===this.activeEvent.data.snapTo)i.fromPosition.setFromMatrixPosition(e.object.matrixWorld);else if("surface"===this.activeEvent.data.snapTo){if(i.fromPosition.copy(e.point),"bbox"===this.activeEvent.data.snapSurfaceMode){b.copy(t).applyMatrix3(M.setFromMatrix4(i.obj.matrixWorld).transpose());let e=i.obj;b.x>w?x.x=-e.recursiveBBox.min.x:b.x<-w&&(x.x=-e.recursiveBBox.max.x),b.y>w?x.y=-e.recursiveBBox.min.y:b.y<-w&&(x.y=-e.recursiveBBox.max.y),b.z>w?x.z=-e.recursiveBBox.min.z:b.z<-w&&(x.z=-e.recursiveBBox.max.z),x.applyMatrix3(M.invert())}else x.copy(t).multiplyScalar(this.activeEvent.data.snapSurfaceOffset);i.fromPosition.add(x)}this.activeEvent.data.autoOrient&&(b.set(0,1,0).cross(t),b.length()<1e-4&&b.set(-1,0,0).cross(t),x.crossVectors(C,b),i.orientationMatrix.makeBasis(b,x,t)),i.pointStart.copy(i.fromPosition),i.pointEnd.copy(i.pointStart),i.currentDampingFactor=this.activeEvent.snapDampingFactor,i.snapped=!0,this.lastDropDestination!==e.object&&(this.lastDropDestination=e.object,this.activeEvent.actionsDrop.Transition.forEach(t=>{t.play()}),this.activeEvent.actionsDrop.Animation.forEach(t=>{t.play()}),this.activeEvent.actionsDrop.Audio.forEach(t=>{t.dispatchGameControl("start")}),this.activeEvent.actionsDrop.Particles.forEach(t=>{t.dispatchGameControl("start")}),this.activeEvent.actionsDrop.Create.forEach(t=>{t.dispatchThrottled()}))}else{let t=!!this.lastDropDestination;this.lastDropDestination=null,i.currentDampingFactor=this.activeEvent.data.dampingFactor,this.calcPlaneIntersectPos(i.obj,i.pointEnd,this.activeEvent.data.plane,this.activeEvent.data.referenceFrame),t&&i.pointStart.copy(i.pointEnd),this.activeEvent.actionsDrop.Transition.forEach(t=>{t.stop(),null!==t.object.currentState&&t.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrop.Animation.forEach(t=>{t.stop()}),this.activeEvent.actionsDrop.Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.activeEvent.actionsDrop.Particles.forEach(t=>{t.dispatchGameControl("stop")})}this.activeEvent.actionsDrag.Create.forEach(t=>{t.dispatchThrottled()}),this.activeEvent.actionsDrag.SetVariable.forEach(t=>t.checkConditions()),this.activeEvent.actionsDrag.SetVariable.forEach(t=>t.dispatch()),this.activeEvent.actionsDrag.DynamicVariablePlay.forEach(t=>t.dispatch()),this.activeEvent.actionsDrag.ClearLocalStorage.forEach(t=>t.dispatch()),this.activeEvent.actionsDrag.UserAPI.forEach(t=>t.dispatch()),!1===this.activeEvent.wasDragEventTriggered&&(this.activeEvent.wasDragEventTriggered=!0,this.activeEvent.actionsDrag.Transition.forEach(t=>{t.play()}),this.activeEvent.actionsDrag.Animation.forEach(t=>{t.play()}),this.activeEvent.actionsDrag.Audio.forEach(t=>{t.dispatchGameControl("start")}),this.activeEvent.actionsDrag.Particles.forEach(t=>{t.dispatchGameControl("start")})),this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>{!this.activeEvent||(this.activeEvent.wasDragEventTriggered=!1,this.activeEvent.actionsDrag.Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Particles.forEach(t=>{t.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Transition.forEach(t=>{t.stop(),null!==t.object.currentState&&t.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrag.Animation.forEach(t=>{t.stop()}))},500),this.updateDragItem(i),i.obj.dispatchEvent({type:"requestRender"})}},this.onPointerUp=t=>{if(this.activeEvent&&this.activeEvent.activeDragItem){"hand"===this.activeEvent.data.cursor&&this.setCursor("grab");let t="dynamic"===this.activeEvent.activeDragItem.obj.data.physics?.rigidBody;if(!1===this.activeEvent.activeDragItem.snapped&&this.activeEvent.data.drop&&this.activeEvent.data.resetOnSnapFail&&(!1===this.eventManager.controlsManager.usePhysics||!t)&&(this.activeEvent.activeDragItem.reset=this.activeEvent.data.resetOnSnapFail,this.activeEvent.activeDragItem.paused=!1,this.activeEvent.activeDragItem.currentDampingFactor=this.activeEvent.resetDampingFactor),this.eventManager.controlsManager.usePhysics&&t){let t=this.activeEvent.activeDragItem,e=this.eventManager.controlsManager.sharedGameControlGlobals,a=e.entitiesWithTransformAnim.lastIndexOf(t.obj);-1!==a&&e.entitiesWithTransformAnim.splice(a,1);let i=t.obj.rigidBody;i&&(e.kinematicBodyToEntity.delete(i.handle),i.setBodyType(0,!0)),t.paused=!0}!0===this.activeEvent.wasDragEventTriggered&&(this.activeEvent.wasDragEventTriggered=!1,this.activeEvent.actionsDrag.Transition.forEach(t=>{t.stop(),null!==t.object.currentState&&t.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrag.Animation.forEach(t=>{t.stop()}),this.activeEvent.actionsDrag.Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Particles.forEach(t=>{t.dispatchGameControl("stop")}),this.activeEvent.actionsDrop.SetVariable.forEach(t=>t.checkConditions()),this.activeEvent.actionsDrop.SetVariable.forEach(t=>t.dispatch()),this.activeEvent.actionsDrop.DynamicVariablePlay.forEach(t=>t.dispatch()),this.activeEvent.actionsDrop.ClearLocalStorage.forEach(t=>t.dispatch()),this.activeEvent.actionsDrop.UserAPI.forEach(t=>t.dispatch())),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0)}}}connect(){let t={};if(this.eventContext.page.traverseEntity(e=>{e.component&&(t[e.component.uuid]?t[e.component.uuid].push(e.uuid):t[e.component.uuid]=[e.uuid])}),this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(t=>"DragDrop"===t.data.type&&!t.data.disabled).forEach(a=>{this.events.push(new F(e,a.id,a.data,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager,t))})}),!this.events.length)return;this.domEventsNeeded.clear(),this.domEventsNeeded.add("pointerdown");let e=this.eventContext.domElement;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointermove",this.onPointerMove),e.addEventListener("pointerup",this.onPointerUp),this.domEventsNeeded.add("pointermove")}disconnect(){if(!this.events.length)return;this.domEventsNeeded.clear();let t=this.eventContext.domElement;t.removeEventListener("pointerdown",this.onPointerDown),t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),null!==this.trailingCursorTimer&&(clearTimeout(this.trailingCursorTimer),this.trailingCursorTimer=null),this.trailingCursorEvent=null,this.events.forEach(t=>t.dispose())}setCursor(t){this.eventContext.domElement.style.cursor=t}onAnimationFrameDamping(){for(let t of this.events)for(let e of t.dragItems)e.paused||this.updateDragItem(e,!0)}calcPlaneIntersectPos(t,e,a,i){let{getCamera:r,raycaster:o}=this.eventContext;r().getWorldDirection(f),f.negate();let n=j.identity();switch("parent"===i?p(t.parent.matrixWorld,{quaternion:n}):"local"===i&&p(t.matrixWorld,{quaternion:n}),a){case"x":b.set(1,0,0).applyQuaternion(n),P.copy(f).cross(b),T.copy(b).cross(P);break;case"y":b.set(0,1,0).applyQuaternion(n),P.copy(f).cross(b),T.copy(b).cross(P);break;case"z":b.set(0,0,1).applyQuaternion(n),P.copy(f).cross(b),T.copy(b).cross(P);break;case"xy":T.set(0,0,1).applyQuaternion(n);break;case"yz":T.set(1,0,0).applyQuaternion(n);break;case"xz":T.set(0,1,0).applyQuaternion(n);break;case"adaptive":f.angleTo(x.set(0,1,0))>Math.PI/6?(b.crossVectors(x.set(0,1,0),f),T.crossVectors(b,x)):T.set(0,1,0);break;default:T.copy(f)}D.setFromMatrixPosition(t.matrixWorld);let s=t.userData.lockedPlane?t.userData.worldPosition0:D;if(y.setFromNormalAndCoplanarPoint(T,s),o.ray.intersectPlane(y,e)&&("x"===a||"y"===a||"z"===a)){let t=x.subVectors(e,s).dot(b);e.copy(s).addScaledVector(b,t)}}updateDragItem(t,e=!1){D.setFromMatrixPosition(t.obj.matrixWorld),"current"===t.reset?E.subVectors(t.fromPosition,D).divideScalar(t.currentDampingFactor):"original"===t.reset?(E.subVectors(t.obj.userData.worldPosition0,D).divideScalar(t.currentDampingFactor),t.fromPosition.copy(t.obj.userData.worldPosition0),t.pointStart.copy(t.fromPosition),t.pointEnd.copy(t.pointStart)):E.subVectors(t.pointEnd,t.pointStart).add(t.fromPosition).sub(D).divideScalar(t.currentDampingFactor),t.paused=!(t.currentDampingFactor>1)||E.length()<.01,(this.activeEvent&&1===this.activeEvent.data.dampingFactor||e)&&S(t,E.add(D),this.activeEvent?.data.drop&&this.activeEvent?.data.autoOrient&&t.snapped?t.orientationMatrix:null),t.obj.dispatchEvent({type:"beginEvent",eventName:"DragDrop"}),this.eventManager.requestRender()}updateCursorFromRaycast(){let{raycaster:t,page:e}=this.eventContext,a=e.raycastWithClones(t),i=!1;for(let t of this.events){for(let{obj:e}of t.dragItems)if(e===a[0]?.object||e===a[0]?.object?.object||c.is(e)&&e.isAncestorOf(a[0]?.object.uuid)){switch(i=!0,t.data.cursor){case"hand":this.setCursor("grab");break;case"move":this.setCursor("move")}break}if(i)break}i||this.setCursor("default")}};a("DragDrop",({eventContext:t,eventManager:e})=>new k(t,e)),d("dragdrop");
|
|
1
|
+
import{a as t}from"./runtime-chunk-QJMMF3L2.js";import{a as e,b as a}from"./runtime-chunk-DZNU62CT.js";import{a as i}from"./runtime-chunk-VAVYZ35B.js";import"./runtime-chunk-FQNSP44B.js";import{h as r}from"./runtime-chunk-KJQWLDYH.js";import"./runtime-chunk-RWYT7G6G.js";import{g as o}from"./runtime-chunk-AEPWABER.js";import"./runtime-chunk-TU4KDRKR.js";import"./runtime-chunk-HOOQDTK7.js";import"./runtime-chunk-PWMK5MVJ.js";import"./runtime-chunk-ZFM73G2B.js";import"./runtime-chunk-ZA3HZGIR.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{f as n,g as s}from"./runtime-chunk-33EF3BLM.js";import{h as c,v as h}from"./runtime-chunk-WYIK4MJQ.js";import"./runtime-chunk-RTLL6WIB.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-BFGZJ4LR.js";import{a as d}from"./runtime-chunk-TZCHGFVF.js";import{Qa as p}from"./runtime-chunk-F6XTFQMZ.js";import{Gc as l,Hc as v,Ic as u,Qc as m,td as g}from"./runtime-chunk-KPOUV3HD.js";import"./runtime-chunk-ML3Z74BL.js";var E=new v,f=new v,D=new v,y=new g,b=new v,x=new v,j=new v,C=new l,M=(new m,new u),P=new v,T=new v,w=.2;function I(t,e){!e||(e[0]<e[1]&&(t.x=Math.min(Math.max(t.x,e[0]),e[1])),e[2]<e[3]&&(t.y=Math.min(Math.max(t.y,e[2]),e[3])),e[4]<e[5]&&(t.z=Math.min(Math.max(t.z,e[4]),e[5])))}var S=function(){let t=new m;return(e,a,i)=>{let n=e.obj;n.parent instanceof r?t.identity():t.copy(n.parent.matrixWorld),t.invert(),n.position.copy(a),"global"===e.reference&&I(n.position,e.limits),n.position.applyMatrix4(t),"parent"===e.reference?I(n.position,e.limits):"local"===e.reference&&(C.copy(e.quat0).invert(),n.position.sub(e.position0),n.position.applyQuaternion(C),I(n.position,e.limits),C.invert(),n.position.applyQuaternion(C),n.position.add(e.position0)),t.multiply(i??n.matrixWorld),p(t,{quaternion:n.quaternion}),n.updateMatrix(),n.updateMatrixWorld(),n.hasNonUniformScale&&n.updateMatrixWorldRigid(),n instanceof h&&o(n.parent)&&n.invalidateDownstreamBooleanData(!0)}}(),F=class{constructor(t,e,a,i,r,o,s){this.object=t,this.id=e,this.data=a,this.dropDestIds=[],this.activeIdx=null,this.wasDragEventTriggered=!1,this.resetDampingFactor=0===this.data.resetSpeed?1:8/this.data.resetSpeed+1,this.snapDampingFactor=0===this.data.snapSpeed?1:8/this.data.snapSpeed+1,this.actionsDrag=n(a,a.dragDropActions.drag,i,r,o,this.object),this.actionsDrop=n(a,a.dragDropActions.drop,i,r,o,this.object);let c=[];this.data.objects.forEach(t=>{let e=i.find(t);!e||!1!==e.data.visible&&(c.push(e),s[e.uuid]&&s[e.uuid].forEach(t=>{let e=i.find(t);!e||!1!==e.data.visible&&c.push(e)}))}),this.data.dropDestinations.forEach(t=>{let e=i.find(t);!e||!1!==e.data.visible&&(this.dropDestIds.push(e.uuid),s[e.uuid]&&s[e.uuid].forEach(t=>{let e=i.find(t);!e||!1!==e.data.visible&&this.dropDestIds.push(e.uuid)}))}),this.dragItems=c.map(t=>("locked"===this.data.planeMode&&(t.userData.lockedPlane=!0),t.userData.worldPosition0=(new v).setFromMatrixPosition(t.matrixWorld),{obj:t,fromPosition:(new v).setFromMatrixPosition(t.matrixWorld),pointStart:new v,pointEnd:new v,paused:!0,currentDampingFactor:this.data.dampingFactor,reset:!1,position0:(new v).copy(t.position),quat0:(new l).copy(t.quaternion),snapped:!1,orientationMatrix:new m,limits:this.data.limits,reference:this.data.referenceFrame}))}get activeDragItem(){return null!==this.activeIdx?this.dragItems[this.activeIdx]:null}dispose(){s(this.actionsDrag),s(this.actionsDrop),this.dragItems.forEach(t=>{t.fromPosition.copy(t.obj.userData.worldPosition0),t.pointStart.copy(t.fromPosition),t.pointEnd.copy(t.pointStart),t.obj.recursiveBBoxNeedsUpdate=!0,t.obj.userData.lockedPlane=void 0,t.obj.position.copy(t.position0),t.obj.quaternion.copy(t.quat0),t.obj.updateMatrix()})}},k=class extends e{constructor(e,a){super(e),this.eventManager=a,this.events=[],this.lastDropDestination=null,this.dragTimeout=null,this.lastCursorRaycastTime=0,this.trailingCursorTimer=null,this.trailingCursorEvent=null,this.onPointerDown=t=>{if(i.length>1)return;this.eventContext.updateRaycaster(t);let{raycaster:e,page:a}=this.eventContext,r=a.raycastWithClones(e);if(this.lastDropDestination=null,0!==r.length){for(let t of this.events){let e=0;for(let{obj:a,pointEnd:i,pointStart:o}of t.dragItems){if(a===r[0].object||a===r[0].object.object||c.is(a)&&a.isAncestorOf(r[0].object.uuid)){if(t.activeIdx=e,t.activeDragItem.reset=!1,t.activeDragItem.currentDampingFactor=t.data.dampingFactor,t.activeDragItem.snapped=!1,"hand"===t.data.cursor&&this.setCursor("grabbing"),this.eventManager.controlsManager.usePhysics){t.activeDragItem.obj.rigidBody&&(t.activeDragItem.obj.rigidBody.setBodyType(2,!0),this.eventManager.controlsManager.sharedGameControlGlobals.kinematicBodyToEntity.set(t.activeDragItem.obj.rigidBody.handle,t.activeDragItem.obj));let e=t.activeDragItem.obj;a.hasNonUniformScale&&a.updateMatrixWorldRigid(),(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(b,C,x),void 0===e.prevQ?(e.prevQ=C.clone(),e.prevT=b.clone()):(e.prevQ.copy(C),e.prevT.copy(b)),this.eventManager.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.push(t.activeDragItem.obj)}return this.calcPlaneIntersectPos(a,o,t.data.plane,t.data.referenceFrame),i.copy(o),(this.eventManager.controlsManager.usePhysics&&"dynamic"===a.data.physics?.rigidBody||!1===t.data.drop||!1===t.data.resetOnSnapFail)&&t.activeDragItem.fromPosition.setFromMatrixPosition(t.activeDragItem.obj.matrixWorld),this.activeEvent=t,void(this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1))}e++}}this.activeEvent=null}else this.activeEvent=null},this.runTrailingCursorUpdate=()=>{this.trailingCursorTimer=null;let t=this.trailingCursorEvent;this.trailingCursorEvent=null,null!==t&&0===i.length&&(this.eventContext.updateRaycaster(t),this.lastCursorRaycastTime=performance.now(),this.updateCursorFromRaycast())},this.onPointerMove=e=>{if(i.length>1)return;this.eventContext.updateRaycaster(e);let{raycaster:a,page:r}=this.eventContext;if(0===i.length){if(!this.events.some(t=>"hand"===t.data.cursor||"move"===t.data.cursor))return;let t=performance.now();return t-this.lastCursorRaycastTime<16?(this.trailingCursorEvent=e,void(null===this.trailingCursorTimer&&(this.trailingCursorTimer=window.setTimeout(this.runTrailingCursorUpdate,32)))):(this.trailingCursorEvent=null,this.lastCursorRaycastTime=t,void this.updateCursorFromRaycast())}if(this.activeEvent&&this.activeEvent.activeDragItem){let e,i=this.activeEvent.activeDragItem;if(i.snapped=!1,this.activeEvent.data.drop&&(e=r.raycastWithClones(a).filter(e=>i.obj!==e.object&&!i.obj.isAncestorOf(e.object.uuid)&&!(e.object instanceof t)&&("all"===this.activeEvent.data.dropOn||this.activeEvent.dropDestIds.some(t=>t===e.object.uuid||r.scene.find(t).isAncestorOf(e.object.uuid))))[0]),e){let t=j.copy(e.face.normal).applyMatrix3(M.getNormalMatrix(e.object.matrixWorld));if("center"===this.activeEvent.data.snapTo)i.fromPosition.setFromMatrixPosition(e.object.matrixWorld);else if("surface"===this.activeEvent.data.snapTo){if(i.fromPosition.copy(e.point),"bbox"===this.activeEvent.data.snapSurfaceMode){b.copy(t).applyMatrix3(M.setFromMatrix4(i.obj.matrixWorld).transpose());let e=i.obj;b.x>w?x.x=-e.recursiveBBox.min.x:b.x<-w&&(x.x=-e.recursiveBBox.max.x),b.y>w?x.y=-e.recursiveBBox.min.y:b.y<-w&&(x.y=-e.recursiveBBox.max.y),b.z>w?x.z=-e.recursiveBBox.min.z:b.z<-w&&(x.z=-e.recursiveBBox.max.z),x.applyMatrix3(M.invert())}else x.copy(t).multiplyScalar(this.activeEvent.data.snapSurfaceOffset);i.fromPosition.add(x)}this.activeEvent.data.autoOrient&&(b.set(0,1,0).cross(t),b.length()<1e-4&&b.set(-1,0,0).cross(t),x.crossVectors(j,b),i.orientationMatrix.makeBasis(b,x,t)),i.pointStart.copy(i.fromPosition),i.pointEnd.copy(i.pointStart),i.currentDampingFactor=this.activeEvent.snapDampingFactor,i.snapped=!0,this.lastDropDestination!==e.object&&(this.lastDropDestination=e.object,this.activeEvent.actionsDrop.Transition.forEach(t=>{t.play()}),this.activeEvent.actionsDrop.Animation.forEach(t=>{t.play()}),this.activeEvent.actionsDrop.Audio.forEach(t=>{t.dispatchGameControl("start")}),this.activeEvent.actionsDrop.Particles.forEach(t=>{t.dispatchGameControl("start")}),this.activeEvent.actionsDrop.Create.forEach(t=>{t.dispatchThrottled()}))}else{let t=!!this.lastDropDestination;this.lastDropDestination=null,i.currentDampingFactor=this.activeEvent.data.dampingFactor,this.calcPlaneIntersectPos(i.obj,i.pointEnd,this.activeEvent.data.plane,this.activeEvent.data.referenceFrame),t&&i.pointStart.copy(i.pointEnd),this.activeEvent.actionsDrop.Transition.forEach(t=>{t.stop(),null!==t.object.currentState&&t.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrop.Animation.forEach(t=>{t.stop()}),this.activeEvent.actionsDrop.Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.activeEvent.actionsDrop.Particles.forEach(t=>{t.dispatchGameControl("stop")})}this.activeEvent.actionsDrag.Create.forEach(t=>{t.dispatchThrottled()}),this.activeEvent.actionsDrag.SetVariable.forEach(t=>t.checkConditions()),this.activeEvent.actionsDrag.SetVariable.forEach(t=>t.dispatch()),this.activeEvent.actionsDrag.DynamicVariablePlay.forEach(t=>t.dispatch()),this.activeEvent.actionsDrag.ClearLocalStorage.forEach(t=>t.dispatch()),this.activeEvent.actionsDrag.UserAPI.forEach(t=>t.dispatch()),!1===this.activeEvent.wasDragEventTriggered&&(this.activeEvent.wasDragEventTriggered=!0,this.activeEvent.actionsDrag.Transition.forEach(t=>{t.play()}),this.activeEvent.actionsDrag.Animation.forEach(t=>{t.play()}),this.activeEvent.actionsDrag.Audio.forEach(t=>{t.dispatchGameControl("start")}),this.activeEvent.actionsDrag.Particles.forEach(t=>{t.dispatchGameControl("start")})),this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>{!this.activeEvent||(this.activeEvent.wasDragEventTriggered=!1,this.activeEvent.actionsDrag.Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Particles.forEach(t=>{t.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Transition.forEach(t=>{t.stop(),null!==t.object.currentState&&t.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrag.Animation.forEach(t=>{t.stop()}))},500),this.updateDragItem(i),i.obj.dispatchEvent({type:"requestRender"})}},this.onPointerUp=t=>{if(this.activeEvent&&this.activeEvent.activeDragItem){"hand"===this.activeEvent.data.cursor&&this.setCursor("grab");let t="dynamic"===this.activeEvent.activeDragItem.obj.data.physics?.rigidBody;if(!1===this.activeEvent.activeDragItem.snapped&&this.activeEvent.data.drop&&this.activeEvent.data.resetOnSnapFail&&(!1===this.eventManager.controlsManager.usePhysics||!t)&&(this.activeEvent.activeDragItem.reset=this.activeEvent.data.resetOnSnapFail,this.activeEvent.activeDragItem.paused=!1,this.activeEvent.activeDragItem.currentDampingFactor=this.activeEvent.resetDampingFactor),this.eventManager.controlsManager.usePhysics&&t){let t=this.activeEvent.activeDragItem,e=this.eventManager.controlsManager.sharedGameControlGlobals,a=e.entitiesWithTransformAnim.lastIndexOf(t.obj);-1!==a&&e.entitiesWithTransformAnim.splice(a,1);let i=t.obj.rigidBody;i&&(e.kinematicBodyToEntity.delete(i.handle),i.setBodyType(0,!0)),t.paused=!0}!0===this.activeEvent.wasDragEventTriggered&&(this.activeEvent.wasDragEventTriggered=!1,this.activeEvent.actionsDrag.Transition.forEach(t=>{t.stop(),null!==t.object.currentState&&t.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrag.Animation.forEach(t=>{t.stop()}),this.activeEvent.actionsDrag.Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Particles.forEach(t=>{t.dispatchGameControl("stop")}),this.activeEvent.actionsDrop.SetVariable.forEach(t=>t.checkConditions()),this.activeEvent.actionsDrop.SetVariable.forEach(t=>t.dispatch()),this.activeEvent.actionsDrop.DynamicVariablePlay.forEach(t=>t.dispatch()),this.activeEvent.actionsDrop.ClearLocalStorage.forEach(t=>t.dispatch()),this.activeEvent.actionsDrop.UserAPI.forEach(t=>t.dispatch())),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0)}}}connect(){let t={};if(this.eventContext.page.traverseEntity(e=>{e.component&&(t[e.component.uuid]?t[e.component.uuid].push(e.uuid):t[e.component.uuid]=[e.uuid])}),this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(t=>"DragDrop"===t.data.type&&!t.data.disabled).forEach(a=>{this.events.push(new F(e,a.id,a.data,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager,t))})}),!this.events.length)return;this.domEventsNeeded.clear(),this.domEventsNeeded.add("pointerdown");let e=this.eventContext.domElement;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointermove",this.onPointerMove),e.addEventListener("pointerup",this.onPointerUp),this.domEventsNeeded.add("pointermove")}disconnect(){if(!this.events.length)return;this.domEventsNeeded.clear();let t=this.eventContext.domElement;t.removeEventListener("pointerdown",this.onPointerDown),t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),null!==this.trailingCursorTimer&&(clearTimeout(this.trailingCursorTimer),this.trailingCursorTimer=null),this.trailingCursorEvent=null,this.events.forEach(t=>t.dispose())}setCursor(t){this.eventContext.domElement.style.cursor=t}onAnimationFrameDamping(){for(let t of this.events)for(let e of t.dragItems)e.paused||this.updateDragItem(e,!0)}calcPlaneIntersectPos(t,e,a,i){let{getCamera:r,raycaster:o}=this.eventContext;r().getWorldDirection(f),f.negate();let n=C.identity();switch("parent"===i?p(t.parent.matrixWorld,{quaternion:n}):"local"===i&&p(t.matrixWorld,{quaternion:n}),a){case"x":b.set(1,0,0).applyQuaternion(n),P.copy(f).cross(b),T.copy(b).cross(P);break;case"y":b.set(0,1,0).applyQuaternion(n),P.copy(f).cross(b),T.copy(b).cross(P);break;case"z":b.set(0,0,1).applyQuaternion(n),P.copy(f).cross(b),T.copy(b).cross(P);break;case"xy":T.set(0,0,1).applyQuaternion(n);break;case"yz":T.set(1,0,0).applyQuaternion(n);break;case"xz":T.set(0,1,0).applyQuaternion(n);break;case"adaptive":f.angleTo(x.set(0,1,0))>Math.PI/6?(b.crossVectors(x.set(0,1,0),f),T.crossVectors(b,x)):T.set(0,1,0);break;default:T.copy(f)}D.setFromMatrixPosition(t.matrixWorld);let s=t.userData.lockedPlane?t.userData.worldPosition0:D;if(y.setFromNormalAndCoplanarPoint(T,s),o.ray.intersectPlane(y,e)&&("x"===a||"y"===a||"z"===a)){let t=x.subVectors(e,s).dot(b);e.copy(s).addScaledVector(b,t)}}updateDragItem(t,e=!1){D.setFromMatrixPosition(t.obj.matrixWorld),"current"===t.reset?E.subVectors(t.fromPosition,D).divideScalar(t.currentDampingFactor):"original"===t.reset?(E.subVectors(t.obj.userData.worldPosition0,D).divideScalar(t.currentDampingFactor),t.fromPosition.copy(t.obj.userData.worldPosition0),t.pointStart.copy(t.fromPosition),t.pointEnd.copy(t.pointStart)):E.subVectors(t.pointEnd,t.pointStart).add(t.fromPosition).sub(D).divideScalar(t.currentDampingFactor),t.paused=!(t.currentDampingFactor>1)||E.length()<.01,(this.activeEvent&&1===this.activeEvent.data.dampingFactor||e)&&S(t,E.add(D),this.activeEvent?.data.drop&&this.activeEvent?.data.autoOrient&&t.snapped?t.orientationMatrix:null),t.obj.dispatchEvent({type:"beginEvent",eventName:"DragDrop"}),this.eventManager.requestRender()}updateCursorFromRaycast(){let{raycaster:t,page:e}=this.eventContext,a=e.raycastWithClones(t),i=!1;for(let t of this.events){for(let{obj:e}of t.dragItems)if(e===a[0]?.object||e===a[0]?.object?.object||c.is(e)&&e.isAncestorOf(a[0]?.object.uuid)){switch(i=!0,t.data.cursor){case"hand":this.setCursor("grab");break;case"move":this.setCursor("move")}break}if(i)break}i||this.setCursor("default")}};a("DragDrop",({eventContext:t,eventManager:e})=>new k(t,e)),d("dragdrop");
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Aa as t,Ac as e,
|
|
1
|
+
import{Aa as t,Ac as e,Ec as s,Fc as i,Gc as r,J as a,Uc as h,a as l,c as o,gc as n,qc as m,v as _,va as u}from"./runtime-chunk-3Q4J5ROW.js";import{d as p}from"./runtime-chunk-UIRA2CWJ.js";import{Fc as d,Mc as c,m as g,qa as B}from"./runtime-chunk-KPOUV3HD.js";import"./runtime-chunk-ML3Z74BL.js";var S=new _,T=new d,f=[[0,0],[0,1,1],[0,1,1,2],[0,1,2,2,3],[0,1,2,3,4,4,5],[0,1,2,3,4,5,7,8,9,10]],R=[.2126729,.7151522,.072175],x=class extends l{constructor(t,e){super("vec4"),this._width=0,this._height=0,this._materials=[],this._input=t,this._opts=e,this._rtL=this._makeRT(1,1,"SplineBloom.L"),this._rtA=this._makeRT(1,1,"SplineBloom.A"),this._rtB=this._makeRT(1,1,"SplineBloom.B"),this._outputTexNode=m(this._rtL.texture),this._buildMaterials()}static get type(){return"SplineBloomNode"}_makeRT(t,e,s){let i=new c(t,e,{minFilter:B,magFilter:B,depthBuffer:!1});return h()&&(i.texture.internalFormat="rgba8unorm-srgb"),i.texture.name=s,i}_buildMaterials(){for(let t of this._materials)t.dispose();this._materials=[];let h=(t,e)=>{let s=new o;return s.name=t,s.colorNode=e,s.depthTest=!1,s.depthWrite=!1,s.blending=g,s.needsUpdate=!0,s},l=this._opts.luminanceThreshold,_=Math.max(this._opts.luminanceSmoothing,1e-4),p=this._input,d=a(()=>{let s=p.sample(e()),a=n(t(l),t(l+_),u(s.rgb,i(R[0],R[1],R[2])));return r(s.rgb.mul(a),a)});this._materials.push(h("SplineBloom.luminance",d()));let c=f[this._opts.kernelSize]??f[3],B=1/Math.max(1,this._width),S=1/Math.max(1,this._height),T=this._passSequence(c.length);for(let t=0;t<c.length;t++){let i=B*(c[t]+.5)*this._opts.blurScale,r=S*(c[t]+.5)*this._opts.blurScale,l=m(T[t].from.texture),o=a(()=>{let t=e();return l.sample(t.add(s(-i,r))).add(l.sample(t.add(s(i,r)))).add(l.sample(t.add(s(i,-r)))).add(l.sample(t.add(s(-i,-r)))).mul(.25)});this._materials.push(h(`SplineBloom.blur${t}`,o()))}}_passSequence(t){let e=[],s=this._rtL;for(let i=0;i<t-1;i++){let t=1&i?this._rtB:this._rtA;e.push({from:s,to:t}),s=t}return e.push({from:s,to:this._rtL}),e}renderBloom(t){t.getDrawingBufferSize(T);let e=Math.max(1,Math.round(.5*T.x)),s=Math.max(1,Math.round(.5*T.y));(e!==this._width||s!==this._height)&&(this._width=e,this._height=s,this._rtL.dispose(),this._rtA.dispose(),this._rtB.dispose(),this._rtL=this._makeRT(e,s,"SplineBloom.L"),this._rtA=this._makeRT(e,s,"SplineBloom.A"),this._rtB=this._makeRT(e,s,"SplineBloom.B"),this._outputTexNode.value=this._rtL.texture,this._buildMaterials());let i=f[this._opts.kernelSize]??f[3],r=this._passSequence(i.length),a=t.getRenderTarget(),h=t.getMRT();t.setMRT(null),t.setRenderTarget(this._rtL),S.material=this._materials[0],S.name="SplineBloom.luminance",S.render(t);for(let e=0;e<r.length;e++)t.setRenderTarget(r[e].to),S.material=this._materials[e+1],S.name=`SplineBloom.blur${e}`,S.render(t);t.setRenderTarget(a),t.setMRT(h)}setup(){return this._outputTexNode}dispose(){for(let t of this._materials)t.dispose();this._materials=[],this._rtL.dispose(),this._rtA.dispose(),this._rtB.dispose()}};p("bloom",function(t,e){return new x(t,e)});
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t}from"./runtime-chunk-NYOF3PNR.js";import{Aa as e,Ac as r,Cb as s,
|
|
1
|
+
import{a as t}from"./runtime-chunk-NYOF3PNR.js";import{Aa as e,Ac as r,Cb as s,Ec as a,Gc as i,Hb as h,J as o,K as l,Kc as _,Q as u,Uc as d,a as m,ac as n,c,fb as p,gc as F,ha as B,hb as T,ib as f,kc as g,qc as C,v as k}from"./runtime-chunk-3Q4J5ROW.js";import{d as x}from"./runtime-chunk-UIRA2CWJ.js";import{Ba as D,Fc as R,Mc as M,m as N,qa as b}from"./runtime-chunk-KPOUV3HD.js";import"./runtime-chunk-ML3Z74BL.js";var S=new k,V=new R,A=[0,1,1,2],v=class extends m{constructor(t,e,r,s,a){super("vec4"),this._width=0,this._height=0,this._halfWidth=0,this._halfHeight=0,this._materials=[],this._inputColor=t,this._input=e,this._depth=r,this._params=s,this._opts=a,this._rtCoC=this._makeRT(1,1,"DoF.CoC","coc"),this._rtMasked=this._makeRT(1,1,"DoF.Masked.Far","color"),this._rtCoCBlurred=this._makeRT(1,1,"DoF.CoC.Blurred","coc"),this._rtBlurA=this._makeRT(1,1,"DoF.Blur.Target.A","blur"),this._rtBlurB=this._makeRT(1,1,"DoF.Blur.Target.B","blur"),this._rtIntermediate=this._makeRT(1,1,"DoF.Intermediate","color"),this._rtNear=this._makeRT(1,1,"DoF.Bokeh.Near","color"),this._rtFar=this._makeRT(1,1,"DoF.Bokeh.Far","color"),this._nearTexNode=C(this._rtNear.texture),this._farTexNode=C(this._rtFar.texture),this._cocBlurredTexNode=C(this._rtCoCBlurred.texture),this._buildMaterials()}static get type(){return"SplineDepthOfFieldNode"}_makeRT(t,e,r,s){let a=new M(t,e,{minFilter:b,magFilter:b,depthBuffer:!1,type:"color"===s&&this._opts.halfFloat?D:void 0});return"coc"!==s&&a.texture.type!==D&&d()&&(a.texture.internalFormat="rgba8unorm-srgb"),a.texture.name=r,a}_buildMaterials(){for(let t of this._materials)t.dispose();this._materials=[];let d=(t,e)=>{let r=new c;return r.name=t,r.colorNode=e,r.depthTest=!1,r.depthWrite=!1,r.blending=N,r.needsUpdate=!0,r},{focusDistance:m,focusRange:T,bokehScale:f,cameraNear:k,cameraFar:x}=this._params,D=this._params.orthographic,R=this._input,M=this._depth,b=this._opts.inputUv??(t=>t),S=t=>t,V=1/Math.max(1,this._halfWidth),v=1/Math.max(1,this._halfHeight),w=o(()=>{let t=r().toVar(),a=M.sample(t).toVar(),o=_(h(a,k,x),k,x),l=_(s(a,k,x),k,x),d=n(D.greaterThan(.5),l,o).sub(m).toVar(),c=F(e(0),T,u(d)).toVar();return i(c.mul(g(d,e(0))),c.mul(g(e(0),d)),0,1)});this._materials.push(d("SplineDoF.coc",w()));let I=this._cocBlurSequence();for(let t=0;t<A.length;t++){let e=V*A[t]+.5*V,s=v*A[t]+.5*v,i=C(I[t].from.texture),h=o(()=>{let t=r();return i.sample(t.add(a(-e,s))).add(i.sample(t.add(a(e,s)))).add(i.sample(t.add(a(e,-s)))).add(i.sample(t.add(a(-e,-s)))).mul(.25)});this._materials.push(d(`SplineDoF.cocBlur${t}`,h()))}let W=C(this._rtCoC.texture),q=o(()=>{let t=r().toVar(),e=B(W.sample(t).g.mul(f),0,1);return R.sample(b(t)).mul(e)});this._materials.push(d("SplineDoF.mask",q()));let H=t(),j=(t,e,s,h,_)=>{let u=o(()=>{let t=r().toVar(),o=s.sample(t).toVar(),u=(h?o.r:o.g).mul(f).toVar(),d=i(0).toVar();return l(u.equal(0),()=>{d.assign(e.sample(_(t)))}).Else(()=>{let r=h?p(u,o.g.mul(f)):u,s=a(V,v).mul(r).toVar(),l=i(0).toVar();for(let r=0;r<H.length;r+=2)l.addAssign(e.sample(_(t.add(s.mul(a(H[r],H[r+1]))))));d.assign(l.div(64))}),d});return d(t,u())},O=C(this._rtCoCBlurred.texture),U=C(this._rtIntermediate.texture);this._materials.push(j("SplineDoF.farBase",C(this._rtMasked.texture),W,!1,S),j("SplineDoF.farFill",U,W,!1,S),j("SplineDoF.nearBase",R,O,!0,b),j("SplineDoF.nearFill",U,O,!0,S))}_cocBlurSequence(){let t=[],e=this._rtCoC;for(let r=0;r<A.length-1;r++){let s=1&r?this._rtBlurB:this._rtBlurA;t.push({from:e,to:s}),e=s}return t.push({from:e,to:this._rtCoCBlurred}),t}renderDoF(t){t.getDrawingBufferSize(V);let e=Math.max(1,Math.round(V.x)),r=Math.max(1,Math.round(V.y));if(e!==this._width||r!==this._height){this._width=e,this._height=r,this._halfWidth=Math.max(1,Math.round(.5*e)),this._halfHeight=Math.max(1,Math.round(.5*r)),this._disposeTargets();let t=this._halfWidth,s=this._halfHeight;this._rtCoC=this._makeRT(e,r,"DoF.CoC","coc"),this._rtMasked=this._makeRT(e,r,"DoF.Masked.Far","color"),this._rtCoCBlurred=this._makeRT(t,s,"DoF.CoC.Blurred","coc"),this._rtBlurA=this._makeRT(t,s,"DoF.Blur.Target.A","blur"),this._rtBlurB=this._makeRT(t,s,"DoF.Blur.Target.B","blur"),this._rtIntermediate=this._makeRT(t,s,"DoF.Intermediate","color"),this._rtNear=this._makeRT(t,s,"DoF.Bokeh.Near","color"),this._rtFar=this._makeRT(t,s,"DoF.Bokeh.Far","color"),this._nearTexNode.value=this._rtNear.texture,this._farTexNode.value=this._rtFar.texture,this._cocBlurredTexNode.value=this._rtCoCBlurred.texture,this._buildMaterials()}let s=this._cocBlurSequence(),a=[this._rtCoC,...s.map(t=>t.to),this._rtMasked,this._rtIntermediate,this._rtFar,this._rtIntermediate,this._rtNear],i=t.getRenderTarget(),h=t.getMRT();t.setMRT(null);for(let e=0;e<a.length;e++)t.setRenderTarget(a[e]),S.material=this._materials[e],S.name=this._materials[e].name,S.render(t);t.setRenderTarget(i),t.setMRT(h)}setup(){let t=this._nearTexNode,e=this._farTexNode,r=T(this._cocBlurredTexNode.r.mul(this._params.bokehScale),1),s=this._inputColor.mul(e.a.oneMinus()).add(e);return f(s,t,r)}_disposeTargets(){this._rtCoC.dispose(),this._rtMasked.dispose(),this._rtCoCBlurred.dispose(),this._rtBlurA.dispose(),this._rtBlurB.dispose(),this._rtIntermediate.dispose(),this._rtNear.dispose(),this._rtFar.dispose()}dispose(){for(let t of this._materials)t.dispose();this._materials=[],this._disposeTargets()}};x("depthOfField",function(t,e,r,s,a){return new v(t,e,r,s,a)});
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t}from"./runtime-chunk-VQPMRUIZ.js";import"./runtime-chunk-WWCXHYAF.js";import{c as e,d as i,f as o,g as s,i as r,k as n,l as a}from"./runtime-chunk-JH5Z7VPK.js";import"./runtime-chunk-N2ZRGNPR.js";import{a as h}from"./runtime-chunk-VAVYZ35B.js";import{e as l,f as c,g as d}from"./runtime-chunk-FQNSP44B.js";import{h as m}from"./runtime-chunk-KK7BC667.js";import"./runtime-chunk-WCJY5BE7.js";import{a as p}from"./runtime-chunk-QR32XGTY.js";import"./runtime-chunk-TU4KDRKR.js";import"./runtime-chunk-VXU3S3Y3.js";import"./runtime-chunk-BBD57YCP.js";import"./runtime-chunk-6FFBLDZX.js";import"./runtime-chunk-K6UEJGDM.js";import"./runtime-chunk-6TZS7SVL.js";import{L as u,S as y,a as g,ea as f,q as v}from"./runtime-chunk-WWIPBG3J.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{f as b,g as x}from"./runtime-chunk-JKFC5GFF.js";import{d as w,h as P}from"./runtime-chunk-PI5WT5IX.js";import"./runtime-chunk-RTLL6WIB.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-QSWZYIFB.js";import{a as M}from"./runtime-chunk-TZCHGFVF.js";import{Ma as E,Na as S,Qa as j,da as A,f as T,ta as k}from"./runtime-chunk-KHCWX7UM.js";import{Bc as D,Cc as C,Dc as O,Ec as z,Fc as R,Oc as F,Pc as W,Re as _,Xc as X,Zc as N,dd as V,ld as I}from"./runtime-chunk-BVVSZMXD.js";import"./runtime-chunk-ML3Z74BL.js";var L=(t,e)=>{let i=e.x-t.x,o=e.y-t.y;return Math.sqrt(i*i+o*o)},B=t=>t*(Math.PI/180),Y=new Map,Q=(t,e,i)=>{let o,s=e.split(/[ ,]+/g);for(let e=0;e<s.length;e+=1)o=s[e],t.addEventListener?t.addEventListener(o,i,!1):t.attachEvent&&t.attachEvent(o,i)},Z=(t,e,i)=>{let o,s=e.split(/[ ,]+/g);for(let e=0;e<s.length;e+=1)o=s[e],t.removeEventListener?t.removeEventListener(o,i):t.detachEvent&&t.detachEvent(o,i)},G=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),q=()=>{if(!(typeof window>"u"))return{x:void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},U=(t,e)=>{e.top||e.right||e.bottom||e.left?(t.style.top=e.top,t.style.right=e.right,t.style.bottom=e.bottom,t.style.left=e.left):(t.style.left=e.x+"px",t.style.top=e.y+"px")},H=(t,e,i)=>{let o=K(t);for(let t in o)if(Object.prototype.hasOwnProperty.call(o,t))if("string"==typeof e)o[t]=e+" "+i;else{let s="";for(let t=0,o=e.length;t<o;t+=1)s+=e[t]+" "+i+", ";o[t]=s.slice(0,-2)}return o},K=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},J=(t,e)=>{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},$=(t,e)=>{if(t.length)for(let i=0,o=t.length;i<o;i+=1)e(t[i]);else e(t)};typeof window<"u"&&(tt="ontouchstart"in window,et=!!window.PointerEvent,it=!!window.MSPointerEvent);var tt,et,it,ot,st={start:"mousedown",move:"mousemove",end:"mouseup"},rt={};function nt(){}et?ot={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:it?ot={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:tt?(ot={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},rt=st):ot=st,nt.prototype.on=function(t,e){var i,o=this,s=t.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var r=0;r<s.length;r+=1)i=s[r],o._handlers_[i]=o._handlers_[i]||[],o._handlers_[i].push(e);return o},nt.prototype.off=function(t,e){var i=this;return i._handlers_=i._handlers_||{},void 0===t?i._handlers_={}:void 0===e?i._handlers_[t]=null:i._handlers_[t]&&i._handlers_[t].indexOf(e)>=0&&i._handlers_[t].splice(i._handlers_[t].indexOf(e),1),i},nt.prototype.trigger=function(t,e){var i,o=this,s=t.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var r=0;r<s.length;r+=1)i=s[r],o._handlers_[i]&&o._handlers_[i].length&&o._handlers_[i].forEach(function(t){t.call(o,{type:i,target:o},e)})},nt.prototype.config=function(t){var e=this;e.options=e.defaults||{},t&&(e.options=((t,e)=>{let i={};for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&Object.prototype.hasOwnProperty.call(e,o)?i[o]=e[o]:Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=t[o]);return i})(e.options,t))},nt.prototype.bindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[e]=function(){"function"==typeof i["on"+e]?i["on"+e].apply(i,arguments):console.warn('[WARNING] : Missing "on'+e+'" handler.')},Q(t,ot[e],i._domHandlers_[e]),rt[e]&&Q(t,rt[e],i._domHandlers_[e]),i},nt.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},Z(t,ot[e],i._domHandlers_[e]),rt[e]&&Z(t,rt[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var at=nt;function ht(t,e){return this.identifier=e.identifier,this.position=e.position,this.frontPosition=e.frontPosition,this.collection=t,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(e),"dynamic"===this.options.mode&&(this.options.restOpacity=0),this.id=ht.id,ht.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}ht.prototype=new at,ht.constructor=ht,ht.id=0,ht.prototype.buildEl=function(t){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},ht.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=(()=>{let t=K("borderRadius");for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e]="50%");return t})(),i=H("transition","opacity",t),o={};return o.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},o.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},o.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},J(o.el,i),"circle"===this.options.shape&&J(o.back,e),J(o.front,e),this.applyStyles(o),this},ht.prototype.applyStyles=function(t){for(var e in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,e))for(var i in t[e])this.ui[e].style[i]=t[e][i];return this},ht.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},ht.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},ht.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null},ht.prototype.show=function(t){var e=this;return e.options.dataOnly||(clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.addToDom(),e.restCallback(),setTimeout(function(){e.ui.el.style.opacity=1},0),e.showTimeout=setTimeout(function(){e.trigger("shown",e.instance),"function"==typeof t&&t.call(this)},e.options.fadeTime)),e},ht.prototype.hide=function(t){var e=this;if(e.options.dataOnly)return e;if(e.ui.el.style.opacity=e.options.restOpacity,clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.removeTimeout=setTimeout(function(){var i="dynamic"===e.options.mode?"none":"block";e.ui.el.style.display=i,"function"==typeof t&&t.call(e),e.trigger("hidden",e.instance)},e.options.fadeTime),e.options.restJoystick){let i=e.options.restJoystick,o={};o.x=!0===i||!1!==i.x?0:e.instance.frontPosition.x,o.y=!0===i||!1!==i.y?0:e.instance.frontPosition.y,e.setPosition(t,o)}return e},ht.prototype.setPosition=function(t,e){var i=this;i.frontPosition={x:e.x,y:e.y};var o=i.options.fadeTime+"ms",s={};s.front=H("transition",["top","left"],o);var r={front:{}};r.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(s),i.applyStyles(r),i.restTimeout=setTimeout(function(){"function"==typeof t&&t.call(i),i.restCallback()},i.options.fadeTime)},ht.prototype.restCallback=function(){var t=this,e={};e.front=H("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},ht.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},ht.prototype.computeDirection=function(t){var e,i,o,s=t.angle.radian,r=Math.PI/4,n=Math.PI/2;if(s>r&&s<3*r&&!t.lockX?e="up":s>-r&&s<=r&&!t.lockY?e="left":s>3*-r&&s<=-r&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=s>-n&&s<n?"left":"right"),t.lockX||(o=s>0?"up":"down"),t.force>this.options.threshold){var a,h={};for(a in this.direction)Object.prototype.hasOwnProperty.call(this.direction,a)&&(h[a]=this.direction[a]);var l={};for(a in this.direction={x:i,y:o,angle:e},t.direction=this.direction,h)h[a]===this.direction[a]&&(l[a]=!0);if(l.x&&l.y&&l.angle)return t;(!l.x||!l.y)&&this.trigger("plain",t),l.x||this.trigger("plain:"+i,t),l.y||this.trigger("plain:"+o,t),l.angle||this.trigger("dir dir:"+e,t)}else this.resetDirection();return t};var lt=ht;function ct(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=ct.id,ct.id+=1,i.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},i.config(e),("static"===i.options.mode||"semi"===i.options.mode)&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let o=getComputedStyle(i.options.zone.parentElement);return o&&"flex"===o.display&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}ct.prototype=new at,ct.constructor=ct,ct.id=0,ct.prototype.prepareNipples=function(){var t=this,e=t.nipples;e.on=t.on.bind(t),e.off=t.off.bind(t),e.options=t.options,e.destroy=t.destroy.bind(t),e.ids=t.ids,e.id=t.id,e.processOnMove=t.processOnMove.bind(t),e.processOnEnd=t.processOnEnd.bind(t),e.get=function(t){if(void 0===t)return e[0];for(var i=0,o=e.length;i<o;i+=1)if(e[i].identifier===t)return e[i];return!1}},ct.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},ct.prototype.begin=function(){var t=this,e=t.options;if("static"===e.mode){var i=t.createNipple(e.position,t.manager.getIdentifier());i.add(),t.idles.push(i)}},ct.prototype.createNipple=function(t,e){var i=this,o=i.manager.scroll,s={},r=i.options,n=i.parentIsFlex?o.x:o.x+i.box.left,a=i.parentIsFlex?o.y:o.y+i.box.top;if(t.x&&t.y)s={x:t.x-n,y:t.y-a};else if(t.top||t.right||t.bottom||t.left){var h=document.createElement("DIV");h.style.display="hidden",h.style.top=t.top,h.style.right=t.right,h.style.bottom=t.bottom,h.style.left=t.left,h.style.position="absolute",r.zone.appendChild(h);var l=h.getBoundingClientRect();r.zone.removeChild(h),s=t,t={x:l.left+o.x,y:l.top+o.y}}var c=new lt(i,{color:r.color,size:r.size,threshold:r.threshold,fadeTime:r.fadeTime,dataOnly:r.dataOnly,restJoystick:r.restJoystick,restOpacity:r.restOpacity,mode:r.mode,identifier:e,position:t,zone:r.zone,frontPosition:{x:0,y:0},shape:r.shape});return r.dataOnly||(U(c.ui.el,s),U(c.ui.front,c.frontPosition)),i.nipples.push(c),i.trigger("added "+c.identifier+":added",c),i.manager.trigger("added "+c.identifier+":added",c),i.bindNipple(c),c},ct.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},ct.prototype.bindNipple=function(t){var e,i=this,o=function(t,o){e=t.type+" "+o.id+":"+t.type,i.trigger(e,o)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",o),t.on("dir:up dir:right dir:down dir:left",o),t.on("plain:up plain:right plain:down plain:left",o)},ct.prototype.pressureFn=function(t,e,i){var o=this,s=0;clearInterval(o.pressureIntervals[i]),o.pressureIntervals[i]=setInterval(function(){var i=t.force||t.pressure||t.webkitForce||0;i!==s&&(e.trigger("pressure",i),o.trigger("pressure "+e.identifier+":pressure",i),s=i)}.bind(o),100)},ct.prototype.onstart=function(t){var e=this,i=e.options,o=t;return t=G(t),e.updateBox(),$(t,function(s){e.actives.length<i.maxNumberOfNipples?e.processOnStart(s):o.type.match(/^touch/)&&(Object.keys(e.manager.ids).forEach(function(i){if(Object.values(o.touches).findIndex(function(t){return t.identifier===i})<0){var s=[t[0]];s.identifier=i,e.processOnEnd(s)}}),e.actives.length<i.maxNumberOfNipples&&e.processOnStart(s))}),e.manager.bindDocument(),!1},ct.prototype.processOnStart=function(t){var e,i=this,o=i.options,s=i.manager.getIdentifier(t),r=t.force||t.pressure||t.webkitForce||0,n={x:t.pageX,y:t.pageY},a=i.getOrCreate(s,n);a.identifier!==s&&i.manager.removeIdentifier(a.identifier),a.identifier=s;var h=function(e){e.trigger("start",e),i.trigger("start "+e.id+":start",e),e.show(),r>0&&i.pressureFn(t,e,e.identifier),i.processOnMove(t)};if((e=i.idles.indexOf(a))>=0&&i.idles.splice(e,1),i.actives.push(a),i.ids.push(a.identifier),"semi"!==o.mode)h(a);else{if(!(L(n,a.position)<=o.catchDistance))return a.destroy(),void i.processOnStart(t);h(a)}return a},ct.prototype.getOrCreate=function(t,e){var i,o=this,s=o.options;return/(semi|static)/.test(s.mode)?(i=o.idles[0])?(o.idles.splice(0,1),i):"semi"===s.mode?o.createNipple(e,t):(console.warn("Coudln't find the needed nipple."),!1):i=o.createNipple(e,t)},ct.prototype.processOnMove=function(t){var e=this,i=e.options,o=e.manager.getIdentifier(t),s=e.nipples.get(o),r=e.manager.scroll;if((t=>isNaN(t.buttons)?0!==t.pressure:0!==t.buttons)(t)){if(!s)return console.error("Found zombie joystick with ID "+o),void e.manager.removeIdentifier(o);if(i.dynamicPage){var n=s.el.getBoundingClientRect();s.position={x:r.x+n.left,y:r.y+n.top}}s.identifier=o;var a=s.options.size/2,h={x:t.pageX,y:t.pageY};i.lockX&&(h.y=s.position.y),i.lockY&&(h.x=s.position.x);var l,c,d=L(h,s.position),m=((t,e)=>{let i=e.x-t.x,o=e.y-t.y;return(t=>t*(180/Math.PI))(Math.atan2(o,i))})(h,s.position),p=B(m),u=d/a,y={distance:d,position:h};if("circle"===s.options.shape?(l=Math.min(d,a),c=((t,e,i)=>{let o={x:0,y:0};return i=B(i),o.x=t.x-e*Math.cos(i),o.y=t.y-e*Math.sin(i),o})(s.position,l,m)):(c=((t,e,i)=>({x:Math.min(Math.max(t.x,e.x-i),e.x+i),y:Math.min(Math.max(t.y,e.y-i),e.y+i)}))(h,s.position,a),l=L(c,s.position)),i.follow){if(d>a){let t=h.x-c.x,i=h.y-c.y;s.position.x+=t,s.position.y+=i,s.el.style.top=s.position.y-(e.box.top+r.y)+"px",s.el.style.left=s.position.x-(e.box.left+r.x)+"px",d=L(h,s.position)}}else h=c,d=l;var g=h.x-s.position.x,f=h.y-s.position.y;s.frontPosition={x:g,y:f},i.dataOnly||U(s.ui.front,s.frontPosition);var v={identifier:s.identifier,position:h,force:u,pressure:t.force||t.pressure||t.webkitForce||0,distance:d,angle:{radian:p,degree:m},vector:{x:g/a,y:-f/a},raw:y,instance:s,lockX:i.lockX,lockY:i.lockY};(v=s.computeDirection(v)).angle={radian:B(180-m),degree:180-m},s.trigger("move",v),e.trigger("move "+s.id+":move",v)}else this.processOnEnd(t)},ct.prototype.processOnEnd=function(t){var e=this,i=e.options,o=e.manager.getIdentifier(t),s=e.nipples.get(o),r=e.manager.removeIdentifier(s.identifier);!s||(i.dataOnly||s.hide(function(){"dynamic"===i.mode&&(s.trigger("removed",s),e.trigger("removed "+s.id+":removed",s),e.manager.trigger("removed "+s.id+":removed",s),s.destroy())}),clearInterval(e.pressureIntervals[s.identifier]),s.resetDirection(),s.trigger("end",s),e.trigger("end "+s.id+":end",s),e.ids.indexOf(s.identifier)>=0&&e.ids.splice(e.ids.indexOf(s.identifier),1),e.actives.indexOf(s)>=0&&e.actives.splice(e.actives.indexOf(s),1),/(semi|static)/.test(i.mode)?e.idles.push(s):e.nipples.indexOf(s)>=0&&e.nipples.splice(e.nipples.indexOf(s),1),e.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(e.manager.ids[r.id]=r.identifier))},ct.prototype.onDestroyed=function(t,e){var i=this;i.nipples.indexOf(e)>=0&&i.nipples.splice(i.nipples.indexOf(e),1),i.actives.indexOf(e)>=0&&i.actives.splice(i.actives.indexOf(e),1),i.idles.indexOf(e)>=0&&i.idles.splice(i.idles.indexOf(e),1),i.ids.indexOf(e.identifier)>=0&&i.ids.splice(i.ids.indexOf(e.identifier),1),i.manager.removeIdentifier(e.identifier),i.manager.unbindDocument()},ct.prototype.destroy=function(){var t=this;for(var e in t.unbindEvt(t.options.zone,"start"),t.nipples.forEach(function(t){t.destroy()}),t.pressureIntervals)Object.prototype.hasOwnProperty.call(t.pressureIntervals,e)&&clearInterval(t.pressureIntervals[e]);t.trigger("destroyed",t.nipples),t.manager.unbindDocument(),t.off(),t.pressureIntervals={},t.nipples=[],t.idles=[],t.actives=[],t.ids=[],t.manager=null};var dt=ct;function mt(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=q(),e._windowBound=!1,e.config(t),e.prepareCollections();var i=function(){var t;e.collections.forEach(function(i){i.forEach(function(i){t=i.el.getBoundingClientRect(),i.position={x:e.scroll.x+t.left,y:e.scroll.y+t.top}})})};return e._onResize=function(){(t=>{Y.has(t)&&clearTimeout(Y.get(t)),Y.set(t,setTimeout(function(){Y.delete(t),t()},100))})(i)},e._onScroll=function(){e.scroll=q()},e.collections}mt.prototype=new at,mt.constructor=mt,mt.prototype.prepareCollections=function(){var t=this;t.collections.create=t.create.bind(t),t.collections.on=t.on.bind(t),t.collections.off=t.off.bind(t),t.collections.destroy=t.destroy.bind(t),t.collections.get=function(e){var i;return t.collections.every(function(t){return!(i=t.get(e))}),i}},mt.prototype.create=function(t){return this.createCollection(t)},mt.prototype.bindWindowEvents=function(){var t=this;t._windowBound||typeof window>"u"||(t._windowBound=!0,Q(window,"resize",t._onResize),Q(window,"scroll",t._onScroll))},mt.prototype.unbindWindowEvents=function(){var t=this;!t._windowBound||typeof window>"u"||(t._windowBound=!1,Z(window,"resize",t._onResize),Z(window,"scroll",t._onScroll))},mt.prototype.createCollection=function(t){var e=this,i=new dt(e,t);return e.bindCollection(i),e.collections.push(i),e.bindWindowEvents(),i},mt.prototype.bindCollection=function(t){var e,i=this,o=function(t,o){e=t.type+" "+o.id+":"+t.type,i.trigger(e,o)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",o),t.on("dir:up dir:right dir:down dir:left",o),t.on("plain:up plain:right plain:down plain:left",o)},mt.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},mt.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||!0===t)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},mt.prototype.getIdentifier=function(t){var e;return t?void 0===(e=void 0===t.identifier?t.pointerId:t.identifier)&&(e=this.latest||0):e=this.index,void 0===this.ids[e]&&(this.ids[e]=this.index,this.index+=1),this.latest=e,this.ids[e]},mt.prototype.removeIdentifier=function(t){var e={};for(var i in this.ids)if(this.ids[i]===t){e.id=i,e.identifier=this.ids[i],delete this.ids[i];break}return e},mt.prototype.onmove=function(t){return this.onAny("move",t),!1},mt.prototype.onend=function(t){return this.onAny("end",t),!1},mt.prototype.oncancel=function(t){return this.onAny("end",t),!1},mt.prototype.onAny=function(t,e){var i,o=this,s="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=G(e);var r=function(t,e,i){i.ids.indexOf(e)>=0&&(i[s](t),t._found_=!0)};return $(e,function(t){i=o.getIdentifier(t),$(o.collections,r.bind(null,t,i)),t._found_||o.removeIdentifier(i)}),!1},mt.prototype.destroy=function(){var t=this;t.unbindDocument(!0),t.unbindWindowEvents(),t.ids={},t.index=0,t.collections.forEach(function(t){t.destroy()}),t.collections=[],t.off()},mt.prototype.onDestroyed=function(t,e){var i=this;if(i.collections.indexOf(e)<0)return!1;i.collections.splice(i.collections.indexOf(e),1),0===i.collections.length&&i.unbindWindowEvents()};var pt=mt,ut=null;function yt(){return ut||(ut=new pt),ut}var gt={create:function(t){return yt().create(t)},destroy:function(){ut&&(ut.destroy(),ut=null)},get factory(){return yt()}},ft=.02,vt=new R,bt=new R,xt=new R,wt=new R,Pt=new R,Mt=new R,Et=new F,St=new F,jt=new F,At=new z,Tt=new z,kt=new W(0,0,0,"YXZ"),Dt=new R(1,0,0),Ct=new R(0,1,0),Ot=new R(0,0,1),zt=new R(1,1,1),Rt=[],Ft=t=>Rt[t]??(Rt[t]=new R),Wt=new R,_t=new R,Xt=new R,Nt=new R,Vt=new z,It=new R,Lt=new z,Bt=new _,Yt=new X,Qt={type:"requestRender"},Zt={type:"updateMatrix"},Gt=class extends D{constructor(t,i,o,s,r,n,a,h,u){super(),this.object=t,this.domElement=i,this.data=o,this.gloabalPhysics=s,this.controlsManager=r,this.cameraFollow=n,this.camera=a,this.page=h,this.sharedAssets=u,this.enableDamping=!0,this.target0=new R,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=e,this.euler0=new W(0,0,0,"YXZ"),this.shearMatrix0=new F,this.cameraShearMatrix0=new F,this.position0Cam=new R,this.quat0Cam=new z,this.scale0Cam=new R,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new _(new R(0,-40,0),new R(0,40,0)),matrix:new F,position:new R,rotation:new z},this.euler=new W(0,0,0,"YXZ"),this.eulerDelta=new R,this.lastPosition=new R,this.lastCameraQuaternion=new z,this.lastCameraPosition=new R,this.PI_2=Math.PI/2,this.prevMouse=new O,this.velocityTarget=new R,this.velocity=new R,this.directionXZ=new R,this.rotVelocityStick=new R,this.rotVelocityTarget=new R,this.rotVelocity=new R,this.rotDirection=new R,this.nonColliderRotOffset=new F,this.nonColliderPosOffset=new F,this.firstPointerId=-1,this.rot=new R,this.path=[],this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.onObject=!1,this.actionState={},this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]],this.collisionEnabled=!0,this.offsetMatrix=new F,this.objectToTarget=new R,this.objectToTarget0=new R,this.objectToCamXZ=new R,this.objectToCamXZ0=new R,this.targetToCamera=new R,this.targetToCamera0=new R,this.cameraPolarAxis0=new R,this.targetPos=new R,this.targetQuat=new z,this.lerpFactorPos=(new R).setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new z,this.objXZQuatInv=new z,this.objXZRotMat=new F,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new R,this.pushedVelocity=new R,this.groundYRotation=0,this.objectRealQuat=new z,this.colliderWorldQuat=new z,this.groundNormal=new R,this.groundTilt=new z,this.groundTiltInv=new z,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new R,this.quaternion=new z,this.scale=new R,this.initialAction=!0,this.onPointerDown=t=>{!(t.target===this.domElement||t.target instanceof HTMLElement&&"SPLINE-VIEWER"===t.target.tagName&&t.target.shadowRoot?.contains(this.domElement))||-1!==this.firstPointerId||(this.firstPointerId=t.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),"keys"!==this.rotBy&&!l&&!c&&this.domElement.requestPointerLock(),this.prevMouse.set(t.clientX,t.clientY))},this.onPointerUp=t=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),"mouse"===t.pointerType&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=t=>{if(t.pointerId!==this.firstPointerId)return;let e=t.clientX-this.prevMouse.x,i=t.clientY-this.prevMouse.y;this.prevMouse.set(t.clientX,t.clientY),"mouse"===t.pointerType&&"keys"!==this.rotBy&&(c&&d<15.5&&!l?(this.eulerDelta.y=-e*this.mouseOrbitSensitivity,this.eulerDelta.x=-i*this.mouseOrbitSensitivity):(this.eulerDelta.y=-t.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-t.movementY*this.mouseOrbitSensitivity)),"mouse"!==t.pointerType&&"drag"===this.rotByTouch&&(this.eulerDelta.y=-e*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-i*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=t=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?Gt.isLocked=!0:Gt.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let t in this.movementState)this.movementState[t]=0},this.onKeyDown=t=>{!(t.target instanceof HTMLInputElement)&&("ArrowLeft"===t.code||"ArrowUp"===t.code||"ArrowRight"===t.code||"ArrowDown"===t.code||"Space"===t.code)&&t.preventDefault();for(let e of this.keyAssignments)if(t.key.toUpperCase()===e[1]||t.key===e[1]){this.movementState[e[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=t=>{for(let e of this.keyAssignments)if(t.key.toUpperCase()===e[1]||t.key===e[1]||t.code.slice(3,t.code.length).toUpperCase()===e[1]){this.movementState[e[0]]=0;break}},this.copyVRGamePadValues=(t,e)=>{for(let i=2;i<4;i++){let o=t.axes[i];0===e?2===i?this.movementState.movePosX=o:this.movementState.movePosZ=o:(t.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,2===i?this.movementState.rotPosY=o:"fly"===this.moveMode&&(this.movementState.moveNegY=o))}},this.sharedGameControlGlobals=r.sharedGameControlGlobals,t===a&&(this.isFirstPerson=!0),this.object.parent instanceof m||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),this.shearMatrix0.copy(this.object.shearMatrix),j(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix}),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let g=this.euler0.clone(),f=g.y;if(this.objectRealQuat.copy(this.quaternion),g.y=0,this.quaternion.setFromEuler(g),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),g.set(0,f,0),this.quaternion.setFromEuler(g),this.rot.setFromEuler(g),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||!0===this.cameraFollow)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),!0===this.cameraFollow){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.camera.parent instanceof m||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),this.cameraShearMatrix0.copy(this.camera.shearMatrix),j(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix})),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let t,e=new R(0,0,-1).applyQuaternion(this.camera.quaternion),i=(new R).subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(i),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(e.y)<1e-6?(i.y=0,e.y=0,t=i.projectOnVector(e)):t=i.y/e.y>0?e.multiplyScalar(i.y/e.y):e.multiplyScalar(i.length()),this.targetToCamera0.copy(t).negate();let o=this.camera.position.clone().add(t);this.objectToTarget0.subVectors(o,this.position);let s=(new W).setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-s.x,s.x=0,s.z=0,s.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(s)}if(this.object instanceof p&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=o.rotByTouch??"joystick",this.rotBy=o.rotBy??"keys",this.rotationMode=o.rotationMode??"normal",this.moveMode=o.moveMode??"walk",this.collisionEnabled=o.collisionEnabled,this.speedTranslate=1*(o.speedTranslate??250),this.speedOrbit=.025*(o.speedRotate??100),this.mouseOrbitSensitivity=16e-6*(o.speedRotate??100),this.keyAssignments=o.keyAssignments.map(t=>{let e=[t[0],t[1]];return"▲"===e[1]?e[1]="ArrowUp":"◀"===e[1]?e[1]="ArrowLeft":"▼"===e[1]?e[1]="ArrowDown":"▶"===e[1]?e[1]="ArrowRight":"⇧"===e[1]?e[1]="Shift":"↵"===e[1]?e[1]="Enter":"Space"===e[1]?e[1]=" ":"⌘"===e[1]?e[1]="Meta":"Ctrl"===e[1]?e[1]="Control":"Esc"===e[1]&&(e[1]="Escape"),e}),"mouse"===o.rotBy){let t;t=this.keyAssignments.findIndex(t=>"rotNegX"===t[0]),-1!==t&&(this.keyAssignments[t][1]=""),t=this.keyAssignments.findIndex(t=>"rotPosX"===t[0]),-1!==t&&(this.keyAssignments[t][1]=""),t=this.keyAssignments.findIndex(t=>"rotPosY"===t[0]),-1!==t&&(this.keyAssignments[t][1]=""),t=this.keyAssignments.findIndex(t=>"rotNegY"===t[0]),-1!==t&&(this.keyAssignments[t][1]="")}this.lerpFactorPosStart=1-.02**(1/(60*(o.delayPos[0]??.3))),this.lerpFactorPosEnd=1-.02**(1/(60*(o.delayPos[1]??.3))),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/(60*(o.delayRot[0]??.3))),this.lerpFactorRotEnd=1-.02**(1/(60*(o.delayRot[1]??.3))),this.lerpFactorPosCamera=1-.02**(1/(60*(o.delayPosCamera??.3))),this.lerpFactorRotCamera=1-.02**(1/(60*(o.delayRotCamera??.3))),this.gravity=12*(this.gloabalPhysics.gravity??k.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??k.defaultData.usePhysics,this.jumpPower=20*o.jumpPower,this.resetYPosition=this.position.y+Math.abs(o.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=o.alignToGround??!1,this.orientMode=o.autoOrientMove?o.orientMode:"none",this.orientWith=o.orientWith??S.defaultDataThirdPerson.orientWith,this.slopeThresh=65*Math.PI/180,"capsule"===o.collider.type?(this.collider.radius=o.collider.radius,this.collider.segment.start.y=o.collider.height/2-o.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=o.collider.height*ft/this.pixelsPerMeter,this.stepThresh=.3*o.collider.height/this.pixelsPerMeter,this.colliderHeight=o.collider.height):"sphere"===o.collider.type?(this.collider.radius=o.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*o.collider.radius*ft/this.pixelsPerMeter,this.stepThresh=2*o.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*o.collider.radius):(this.offset=o.collider.height*ft/this.pixelsPerMeter,this.stepThresh=.3*o.collider.height/this.pixelsPerMeter,this.colliderHeight=o.collider.height),this.collider.type=o.collider.type;let b=(new R).fromArray(o.collider.position.map(t=>"number"==typeof t?t:0)),x=(new z).setFromEuler((new W).fromArray([...o.collider.rotation.map(t=>"number"==typeof t?t:0),"XYZ"]));this.collider.position.copy(b).multiply(this.scale),this.collider.rotation.copy(x),this.collider.matrix.compose(b,x,zt),void 0!==o.cameraXAxis&&(this.cameraXAxis=o.cameraXAxis,this.cameraYAxis=o.cameraYAxis,this.minPolarAngle=o.cameraRotXLimits[0],this.maxPolarAngle=o.cameraRotXLimits[1],this.minAzimuthAngleRel=o.cameraRotYLimits[0],this.maxAzimuthAngleRel=o.cameraRotYLimits[1]),this.forwardDir=o.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=o.runMultiplier??2;let w=2*o.navmesh.destinationHelperRadius;if(w>0){let t=new T;t.push({fi:0,data:{...A.defaultData("light","phong"),alpha:0},id:"layer1"}),t.push({fi:0,data:{...A.defaultData("color"),color:o.navmesh.destinationHelperColor,alpha:o.navmesh.destinationHelperColor.a},id:"layer2"});let e=y({layers:t},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new I(v.create({parameters:{width:w,height:w/10,hollow:.7}}),e),this.navMeshPathDest.material.userData.opacity0=o.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.matrixWorldAutoUpdate=!0,this.camera.matrixWorldAutoUpdate=!0,this.object.shearMatrix.copy(this.shearMatrix0),t){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.parent instanceof m||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),j(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix});let t=(new W).setFromQuaternion(this.quaternion,"YXZ"),e=t.y;this.objectRealQuat.copy(this.quaternion),t.y=0,this.quaternion.setFromEuler(t),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),t.set(0,e,0),this.quaternion.setFromEuler(t),this.rot.setFromEuler(t),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof p?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();!0===this.cameraFollow&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.shearMatrix.copy(this.cameraShearMatrix0),t?(this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.camera.parent instanceof m||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),j(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix}))):this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let t=this.data,e=this.sharedAssets;void 0!==t.gameActions&&(this.actions={},E.list.forEach(i=>{this.actions[i]=b({...t,disabled:!1,type:"GameControl"},t.gameActions[i],this.page,e,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),x(this.actions.idle),x(this.actions.move),x(this.actions.run),x(this.actions.jump)}dispatchStartEvent(t){void 0!==this.actions[t]&&(this.actionState[t]||(this.actionState[t]=!0,this.actions[t].Transition.forEach(t=>{t.play()}),this.actions[t].Animation.forEach(t=>{t.play(!1===this.initialAction)}),this.actions[t].TimelineAnimation.forEach(t=>{t.play()}),this.actions[t].Create.forEach(t=>{t.dispatchStart()}),this.actions[t].Audio.forEach(t=>{t.dispatchGameControl("start")}),this.actions[t].Particles.forEach(t=>{t.dispatchGameControl("start")})))}dispatchStopEvent(t){void 0!==this.actions[t]&&(!this.actionState[t]||(this.actionState[t]=!1,this.actions[t].Transition.forEach(t=>{t.stop(),null!==t.object.currentState&&t.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[t].TimelineAnimation.forEach(t=>{t.stop()}),this.actions[t].Create.forEach(t=>{t.dispatchStop()}),this.actions[t].Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.actions[t].Particles.forEach(t=>{t.dispatchGameControl("stop")})))}get colliderWorldPosition(){return wt.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(t){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let e=(this.isFirstFrame?16.6:t)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*e,o=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let t=Pt.set(0,(0===this.velocity.y?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*e,0).divideScalar(this.pixelsPerMeter),i=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,t,this.object.rigidBody?.collider(0).shape,0,1,!1,8,void 0,void 0,this.object.rigidBody);if(i){this.onObject=!0,this.groundNormal.set(i.normal2.x,i.normal2.y,i.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(o=!0),0===i.collider.parent()?.bodyType()&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let t=i.collider.parent(),s=null!==t&&t.isKinematic()?t:null,r=null===s?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(s.handle);if(null!==s&&r?.userData.isFollowingObj!==this.object.uuid){let t=this.object.getWorldPosition(wt).add(this.collider.position).divideScalar(this.pixelsPerMeter),i=s.velocityAtPoint(t);this.groundVelocity.set(i.x,i.y,i.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=s.angvel().y*e}}else this.onObject=!1}if("walk"===this.moveMode&&this.collisionEnabled&&(1===this.movementState.jump&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*i),"fly"===this.moveMode&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,"+z"===this.forwardDir&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let t=this.navMeshPathDest.material;if("walk"===this.moveMode&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let e=wt.subVectors(this.path[1],this.position),i=Pt.subVectors(this.path[1],this.path[0]);e.dot(i)<0?this.path.shift():(this.directionXZ.x=i.x,this.directionXZ.z=i.z),t.opacity=t.userData.opacity0}else t.opacity-=.05*t.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,("walk"===this.moveMode?this.velocityTarget.x+this.velocityTarget.z===0:0===this.velocityTarget.manhattanLength())?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),"walk"===this.moveMode&&(this.lerpFactorPos.y=1),!1===this.didHit&&0===this.pushedVelocity.manhattanLength()||!1===this.usePhysics?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**i),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**i),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**i)):this.velocity.copy(this.velocityTarget),("walk"===this.moveMode?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||"fly"===this.moveMode)&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let r=xt.copy(this.velocity);if("none"!==this.orientMode&&!1===this.isFirstPerson){let t=Pt.copy(r);t.y=0,r.set(0,r.y,t.length()*("+z"===this.forwardDir?1:-1))}if(this.directionXZ.manhattanLength()>0&&"none"!==this.orientMode&&!1===this.isFirstPerson)if("camera"===this.orientWith&&this.path.length<=1){let t=wt;this.camera.getWorldDirection(t);let e=Mt.copy(Ct).multiplyScalar(t.dot(Ct));t.sub(e);let i=Pt.copy(this.directionXZ);i.x*=-1,this.rot.y=t.angleTo(i)*(t.cross(i).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*("+z"===this.forwardDir?1:-1);if(kt.setFromVector3(this.rot),"walk"===this.moveMode&&(kt.x=0),r.applyEuler(kt),o&&(Tt.setFromUnitVectors(Ct,this.groundNormal),r.applyQuaternion(Tt)),!0===this.usePhysics&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let t=0;for(let i of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(void 0===i.rigidBody||void 0===i.prevQ)continue;(i.hasNonUniformScale?i.matrixWorldRigid:i.matrixWorld).decompose(Wt,Vt,_t);let o=this.object.getWorldPosition(Xt).add(this.collider.position).sub(Wt);Lt.copy(i.prevQ).invert().premultiply(Vt);let n=Mt.subVectors(Wt,i.prevT).add(Nt.copy(o).applyQuaternion(Lt).sub(o)).divideScalar(e).divideScalar(this.pixelsPerMeter),a=i.rigidBody.collider(0).castCollider(n,this.object.rigidBody.collider(0),wt.copy(r).divideScalar(this.pixelsPerMeter),0,e,!1);n.multiplyScalar(this.pixelsPerMeter);let h=P.is(i)?i:i.object;if(null!==a&&this.lastHitObj!==h){let t;i instanceof f&&(t=i);let e=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(e)for(let i of e)"character"===i.data.target&&(i.dispatch(t),h.dispatchEvent(s));this.lastHitObj=h}null!==a&&(Math.abs(n.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=n.x),Math.abs(n.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=n.y),Math.abs(n.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=n.z),Ft(t++).copy(a.normal1).applyQuaternion(i.quaternion))}if(t>0){for(let e=0;e<t;e++){let t=Ft(e),i=t.dot(r);i<0&&r.addScaledVector(t,-i)}r.add(this.pushedVelocity)}else r.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),"normal"===this.rotationMode&&(this.movementState.rotPosX||this.movementState.rotNegX)||"steer"===this.rotationMode&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||"walk"===this.moveMode)?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,"normal"===this.rotationMode&&(this.movementState.rotPosY||this.movementState.rotNegY)||"steer"===this.rotationMode&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(e),this.rotVelocityStick),0===this.rotVelocityTarget.manhattanLength()?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**i):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**i),this.euler.x+=this.rotVelocity.x*e,this.euler.y+=this.rotVelocity.y*e+this.groundYRotation,0===this.rotVelocityTarget.y&&0===this.directionXZ.manhattanLength()?this.rotationAccumWhenOrientWithCamera=0:(!1===this.cameraFollow||"Locked"===this.cameraYAxis)&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*e),!1===this.isFirstPerson&&"none"!==this.orientMode&&this.directionXZ.manhattanLength()>0){if("radial"===this.orientMode){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(Ct,this.euler.y-this.euler0.y);let t=Pt.copy(this.objectToCamXZ).normalize(),i=Mt.copy(r).multiplyScalar(e);i.y=0;let o=i.sub(wt.copy(t).multiplyScalar(i.dot(t))).cross(t).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*e+this.groundYRotation,0!==this.rotVelocityTarget.y&&(!1===this.cameraFollow||"Locked"===this.cameraYAxis)&&(this.euler.y=this.rot.y);if(!0===this.cameraFollow&&("walk"===this.moveMode?"Limit"===this.cameraXAxis?this.euler.x=C.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=C.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):"Limit"===this.cameraXAxis&&(this.euler.x=C.clamp(this.euler.x,-this.PI_2,this.PI_2))),"fly"===this.moveMode?this.rot.x=this.euler.x:this.isFirstPerson&&(kt.copy(this.euler),kt.y=0,this.nonColliderRotOffset.makeRotationFromEuler(kt)),At.setFromAxisAngle(Dt,this.rot.x),Tt.setFromAxisAngle(Ct,this.rot.y),Tt.multiply(At),At.setFromAxisAngle(Ot,this.rot.z),Tt.multiply(At),this.quaternion.copy(Tt),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let t=Pt.copy(r).multiplyScalar(e/this.pixelsPerMeter),i=null;this.didHit=!1;let o=new R;for(let e=0;e<5;e++){let r=t.length(),n=Mt.copy(t).normalize();if(i=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,n,this.object.rigidBody.collider(0).shape,0,r,!1,12,void 0,void 0,this.object.rigidBody),null===i){0===e&&0!==this.directionXZ.manhattanLength()&&(this.lastHitObj=null),o.add(t);break}{this.didHit=!0;let a=this.sharedGameControlGlobals.colliderToEntity.get(i.collider.handle);if(a!==this.lastHitObj&&0===e){this.lastHitObj=a;let t=this.sharedGameControlGlobals.entityToCollisionEvents[a?.uuid];if(t)for(let e of t)if("character"===e.data.target){let t,o=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i.collider.handle))._parent;if(a.cloner)for(let e of a.cloner.children)if(e.rigidBody===o){t=e;break}e.dispatch(t),a.dispatchEvent(s)}}let h=vt.set(i.normal2.x,i.normal2.y,i.normal2.z).applyQuaternion(this.colliderWorldQuat),l=bt.copy(n).multiplyScalar(i.time_of_impact).dot(h),c=i.time_of_impact;if(0===c&&(this.position.y+=this.offset*this.pixelsPerMeter),l>this.offset&&(c=i.time_of_impact*(l-this.offset)/l,o.addScaledVector(n,c)),t.copy(n).multiplyScalar(r-c),Math.acos(-h.y)>this.slopeThresh){let e=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),s=Mt.copy(i.witness2).applyQuaternion(this.colliderWorldQuat);s.y=0;let r=e.add(s);r.y+=this.stepThresh;let n=this.sharedGameControlGlobals.rapierWorld.castShape(r,this.colliderWorldQuat,t,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);null!==n&&0===n.time_of_impact&&(h.y=0,h.normalize())}t.addScaledVector(h,-t.dot(h))}}this.position.addScaledVector(o,this.pixelsPerMeter),wt.copy(this.position).divideScalar(this.pixelsPerMeter),At.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let n=this.object.rigidBody,a=void 0!==n&&It.copy(wt).sub(n.translation()).lengthSq()>1;void 0!==n&&(a?(n.setTranslation(wt,!0),n.setRotation(At,!0)):(n.setNextKinematicTranslation(wt),n.setNextKinematicRotation(At)))}else{let t=this.onObject?1:5,i=r.multiplyScalar(e/t);for(let o=0;o<t;o++)this.position.add(i),this.collisionAdjustment(e/t)}else this.position.addScaledVector(r,e);if("walk"===this.moveMode&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),w(this.position,this.quaternion,this.object.shearMatrix,this.scale,this.object.matrix).multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.object.parent instanceof m?this.object.matrixWorld.multiplyMatrices(this.object.parent.matrixWorld,this.object.matrix).multiply(this.object.pivotMatrix):this.object.matrixWorld.copy(this.object.matrix),this.object.children.forEach(t=>{t.updateMatrixWorld(!0)}),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),!0===this.cameraFollow){this.updateFollowArms();let t=this.objectToTarget.add(this.position),e=this.targetToCamera.add(t);Et.lookAt(e,t,Ct).setPosition(e),Et.decompose(this.targetPos,this.targetQuat,wt),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**i),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**i),this.camera.updateMatrix(),this.camera.matrixWorld.copy(this.camera.matrix),"Limit"===this.cameraYAxis&&"cartesian"===this.orientMode&&(this.euler.y=C.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=C.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(Zt),!(this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(void 0===this.camera||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&("fly"===this.moveMode||!0===this.onObject||!1===this.collisionEnabled)&&(null===this.navMeshPathDest||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)||(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(Qt),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=At.setFromAxisAngle(Ct,"Limit"===this.cameraYAxis&&"radial"!==this.orientMode?C.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);("Locked"!==this.cameraYAxis||"radial"===this.orientMode)&&this.objectToTarget.applyQuaternion(e),t="Limit"===this.cameraXAxis?C.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):C.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=wt.copy(this.cameraPolarAxis0);("Locked"!==this.cameraYAxis||"radial"===this.orientMode)&&i.applyQuaternion(e);let o=Tt.setFromAxisAngle(i,t);"Locked"!==this.cameraYAxis&&this.targetToCamera.applyQuaternion(e),"Locked"!==this.cameraXAxis&&this.targetToCamera.applyQuaternion(o)}groundTiltAdjustment(t){180*Ct.angleTo(t)/Math.PI<15||180*Ct.angleTo(t)/Math.PI>85?At.identity():At.setFromUnitVectors(Ct,t),this.groundTilt.slerp(At,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=bt.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=Et.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(wt,At,Pt).compose(wt,At,zt);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(t=>{if(t===this.object||t.isDescendantOf(this.object)||!t.bvhGeometry||!t.bvhGeometry.boundsTree)return;Yt.makeEmpty(),t.updateMatrixWorldRigid();let o=t.matrixWorldRigid,s=St.copy(o).invert(),r=jt.copy(St).multiply(i);Bt.copy(this.collider.segment),Bt.start.applyMatrix4(r),Bt.end.applyMatrix4(r);let n=vt.copy(this.position).applyMatrix4(s);Yt.expandByPoint(Bt.start),Yt.expandByPoint(Bt.end),Yt.min.addScalar(-this.collider.radius),Yt.max.addScalar(this.collider.radius),t.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:t=>t.distanceToPoint(Bt.end),intersectsBounds:t=>t.intersectsBox(Yt),intersectsTriangle:t=>{let i=wt,s=Pt,r=t.closestPointToSegment(Bt,i,s);if(r<this.collider.radius){let t=this.collider.radius-r,a=s.sub(i).normalize(),h=Mt.copy(n);h.addScaledVector(a,t);let l=h.applyMatrix4(o).sub(this.position);e.add(l),Bt.start.addScaledVector(a,t),Bt.end.addScaledVector(a,t)}}})}),Yt.makeEmpty(),Bt.copy(this.collider.segment),Bt.start.applyMatrix4(i),Bt.end.applyMatrix4(i),Yt.expandByPoint(Bt.start),Yt.expandByPoint(Bt.end),Yt.min.addScalar(-this.collider.radius),Yt.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:t=>t.distanceToPoint(Bt.end),intersectsBounds:t=>t.intersectsBox(Yt),intersectsTriangle:t=>{let i=wt,o=Pt,s=t.closestPointToSegment(Bt,i,o);if(s<this.collider.radius){let t=this.collider.radius-s,r=o.sub(i).normalize();this.alignToGround&&this.groundTiltAdjustment(r),e.addScaledVector(r,t),Bt.start.addScaledVector(r,t),Bt.end.addScaledVector(r,t)}}}),this.onObject=Math.abs(e.y)>Math.abs(t*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let o=Math.max(0,e.length()-1e-5);e.normalize().multiplyScalar(o),this.position.add(e)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},qt=Gt;qt.isLocked=!1;var Ut,Ht,Kt,Jt={cs:6,ch:2,walkableSlopeAngle:90,walkableHeight:20,walkableClimb:5,walkableRadius:0,maxEdgeLen:12,maxSimplificationError:1.3,minRegionArea:8,mergeRegionArea:20,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1};n.then(t=>{Ut=t,Ht=new t.Vec3,Kt=new t.Vec3});var $t=new R,te=class{constructor(e=!1,i=!1){var s;this.usePhysics=e,this.isExport=i,this.onPointerDown=t=>{if(1!==h.length)return;let{raycaster:e,page:i}=this.eventContext;this.eventContext.updateRaycaster(t);let o=i.raycastWithClones(e);if(0!==o.length){if(this.gameControl){let t=$t.copy(this.gameControl.colliderWorldPosition);t.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(t,o[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(e,i)=>s=>{let n;if(s instanceof t){if(!s.objectForSample)return!0===s.object.dataPatched.physics.fusedBody&&"dynamic"===s.object.dataPatched.physics.rigidBody||void 0;if(s.objectForSample.dataPatched.physics.fusedBody)return;n=s.object}else if(s instanceof f)n=s.object;else if(n=s,!1===n.dataPatched.cloner?.disabled&&n.dataPatched.cloner?.hideBase&&!0!==n.dataPatched.physics?.fusedBody)return!0;if(i&&!n.userData.navmesh)return;let a=n.dataPatched;if(!a.visible&&!0!==a.physics?.enabled)return!0;s.updateMatrixWorldRigid();let h=r(a),l=n.userData.hasDestroy,c=n.userData.hasDrag,d=!1,m=!1;for(let t of a.events)!0!==t.data.disabled&&("GameControl"===t.data.type?d=!0:"Follow"===t.data.type&&(m=!0));if(d||h||m||l||c)return!0;if(this.usePhysics&&"dynamic"===a.physics?.rigidBody){if(this.usePhysics&&a.physics?.fusedBody)return!0}else if("geometry"in s&&s.geometry&&e.push(o(s.geometry,s.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return s.traverseObject((i,s)=>{if(0===s)return;let r;if(i instanceof t){if(!i.objectForSample)return!0===i.object.dataPatched.physics.fusedBody&&"dynamic"===i.object.dataPatched.physics.rigidBody||void 0;if(i.objectForSample.dataPatched.physics.fusedBody)return;r=i.object}else if(i instanceof f)r=i.object;else if(r=i,i.dataPatched.cloner?.hideBase)return!0;let n=r.dataPatched;if(!n.visible&&!0!==n.physics?.enabled)return!0;"geometry"in i&&i.geometry&&e.push(o(i.geometry,i.matrixWorld))}),!0},this.traverseNoPhysics=(e,i)=>s=>{let n;if(s instanceof t)return;n=s instanceof f?s.object:s;let a=n.dataPatched;if("visibility"===a.physics.enabled?!a.visible:!a.physics.enabled)return!0;if(i&&!n.userData.navmesh)return;let h=s.geometry,l=!0===n.userData.hasDestroy,c=!0===n.userData.hasDrag;if(r(a)||l||c||n.dataPatched.events.some(t=>!0!==t.data.disabled&&"GameControl"===t.data.type))return!0;h&&e.push(o(h,s.matrixWorld))},this.navmeshWasm=Ut,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(i?(s=a??"https://cdn.spline.design/@splinetool/runtime@2.0.93/build/",`\n(async function() {\n\tconst [wasmImport, wasmBinary] = await Promise.all([\n\t\timport('${s}' + 'navmesh.js'),\n\t\tfetch('${s}' + 'navmesh.wasm').then((res) => res.arrayBuffer()),\n\t]);\n\tconst wasmModule = wasmImport.default;\n\tself.module = await wasmModule({ wasmBinary });\n\tpostMessage('ready');\n})();\n`):"\n(async function() {\n\tconst [wasmImport, wasmBinary] = await Promise.all([\n\t\timport(self.location.origin + '/_libraries/navmesh.js'),\n\t\tfetch(self.location.origin + '/_libraries/navmesh.wasm').then((res) => res.arrayBuffer()),\n\t]);\n\tconst wasmModule = wasmImport.default;\n\tself.module = await wasmModule({ wasmBinary });\n\tpostMessage('ready');\n})();\n")+"\n\nonmessage = function(messageEvent) {\n\tconst meshData = messageEvent.data;\n\tconst positions = meshData[0];\n\tconst offset = meshData[1];\n\tconst indices = meshData[2];\n\tconst indicesLength = meshData[3];\n\tconst parameters = meshData[4];\n\n\tconst module = self.module;\n\tconst rc = new module.rcConfig();\n\trc.cs = parameters.cs;\n\trc.ch = parameters.ch;\n\trc.borderSize = parameters.borderSize ? parameters.borderSize : 0;\n\trc.tileSize = parameters.tileSize ? parameters.tileSize : 0;\n\trc.walkableSlopeAngle = parameters.walkableSlopeAngle;\n\trc.walkableHeight = parameters.walkableHeight;\n\trc.walkableClimb = parameters.walkableClimb;\n\trc.walkableRadius = parameters.walkableRadius;\n\trc.maxEdgeLen = parameters.maxEdgeLen;\n\trc.maxSimplificationError = parameters.maxSimplificationError;\n\trc.minRegionArea = parameters.minRegionArea;\n\trc.mergeRegionArea = parameters.mergeRegionArea;\n\trc.maxVertsPerPoly = parameters.maxVertsPerPoly;\n\trc.detailSampleDist = parameters.detailSampleDist;\n\trc.detailSampleMaxError = parameters.detailSampleMaxError;\n\n\tif (!self.navMesh) {\n\t\tself.navMesh = new module.NavMesh();\n\t}\n\tself.navMesh.build(positions, offset, indices, indicesLength, rc);\n\n\tconst navmeshData = navMesh.getNavmeshData();\n\tconst arrView = new Uint8Array(module.HEAPU8.buffer, navmeshData.dataPointer, navmeshData.size);\n\tconst ret = new Uint8Array(navmeshData.size);\n\tret.set(arrView);\n\tnavMesh.freeNavmeshData(navmeshData);\n\n\tpostMessage(ret);\n}\n"])),this._worker=new Worker(this._workerURL),this.whenWorkerReady=new Promise(t=>{this._worker.addEventListener("message",()=>t(),{once:!0})})}init(t,e,i){this.gameControl=e,this.eventContext=i,this.setDefaultQueryExtent((new R).setScalar(t.ch*t.walkableRadius*1.2)),this._worker.onmessage=()=>{this.createNavMesh(i.page,t,t=>{this.buildFromNavmeshData(t.data)})},this.eventContext.renderer.domElement.addEventListener("pointerdown",this.onPointerDown)}createNavMesh(t,e,i){e.objects.forEach(e=>{let i=t.scene.find(e);i.traverseEntity(t=>{t.userData.navmesh=!0}),i.cloner?.traverseObject(t=>{t.userData.navmesh=!0})});let o=[],s=(this.usePhysics?this.traverseWithPhysics:this.traverseNoPhysics)(o,"custom"===e.zones);if(t.traverseChildren(s),e.objects.forEach(e=>{let i=t.scene.find(e);i.traverseEntity(t=>{t.userData.navmesh=void 0}),i.cloner?.traverseObject(t=>{t.userData.navmesh=void 0})}),0===o.length)return!1;let r=g(o),{positions:n,triIndices:a}=u(r.getAttribute("position"),r.getIndex());return this._worker.postMessage([n,n.length/3,a,a.length,{...Jt,...e}]),this._worker.onmessage=i,!0}createDebugNavGeometry(){let t,e,i=this.navMesh.getDebugNavMesh(),o=i.getTriangleCount(),s=new Uint32Array(3*o),r=new Float32Array(3*o*3);for(t=0;t<3*o;t++)s[t]=t;for(t=0;t<o;t++)for(e=0;e<3;e++){let o=i.getTriangle(t).getPoint(e);r[9*t+3*e+0]=o.x,r[9*t+3*e+1]=o.y,r[9*t+3*e+2]=o.z}let n=new V;return n.setIndex(new N(s,1)),n.setAttribute("position",new N(r,3)),n}getClosestPoint(t){return Ht.x=t.x,Ht.y=t.y,Ht.z=t.z,this.navMesh.getClosestPoint(Ht)}getClosestPointToRef(t,e){Ht.x=t.x,Ht.y=t.y,Ht.z=t.z;let i=this.navMesh.getClosestPoint(Ht);e.set(i.x,i.y,i.z)}getRandomPointAround(t,e){return Ht.x=t.x,Ht.y=t.y,Ht.z=t.z,this.navMesh.getRandomPointAround(Ht,e)}getRandomPointAroundToRef(t,e,i){Ht.x=t.x,Ht.y=t.y,Ht.z=t.z;let o=this.navMesh.getRandomPointAround(Ht,e);i.set(o.x,o.y,o.z)}moveAlong(t,e){return Ht.x=t.x,Ht.y=t.y,Ht.z=t.z,Kt.x=e.x,Kt.y=e.y,Kt.z=e.z,this.navMesh.moveAlong(Ht,Kt)}moveAlongToRef(t,e,i){return Ht.x=t.x,Ht.y=t.y,Ht.z=t.z,Kt.x=e.x,Kt.y=e.y,Kt.z=e.z,this.navMesh.moveAlong(Ht,Kt)}computePath(t,e){let i=this.getClosestPoint(e);if(Kt.x=i.x,Kt.y=i.y,Kt.z=i.z,Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)+Math.pow(e.z-i.z,2))>this.getDefaultQueryExtent().y)return[];this.getClosestPoint(t);let o=this.navMesh.computePath(Ht,Kt),s=o.getPointCount(),r=[];for(let t=0;t<s;t++){let e=o.getPoint(t);r.push(new R(e.x,e.y,e.z))}return r}createCrowd(t,e){return new ee(this,t,e)}setDefaultQueryExtent(t){Ht.x=t.x,Ht.y=t.y,Ht.z=t.z,this.navMesh.setDefaultQueryExtent(Ht)}getDefaultQueryExtent(){return this.navMesh.getDefaultQueryExtent()}buildFromNavmeshData(t){let e=t.length*t.BYTES_PER_ELEMENT,i=this.navmeshWasm._malloc(e),o=new Uint8Array(this.navmeshWasm.HEAPU8.buffer,i,e);o.set(t);let s=new this.navmeshWasm.NavmeshData;s.dataPointer=o.byteOffset,s.size=t.length,this.navMesh.buildFromNavmeshData(s),this.navmeshWasm._free(o.byteOffset)}getNavmeshData(){let t=this.navMesh.getNavmeshData(),e=new Uint8Array(this.navmeshWasm.HEAPU8.buffer,t.dataPointer,t.size),i=new Uint8Array(t.size);return i.set(e),this.navMesh.freeNavmeshData(t),i}getDefaultQueryExtentToRef(t){let e=this.navMesh.getDefaultQueryExtent();t.set(e.x,e.y,e.z)}dispose(){this.navMesh.destroy(),this._worker.terminate(),URL.revokeObjectURL(this._workerURL),this.eventContext?.renderer.domElement.removeEventListener("pointerdown",this.onPointerDown)}addCylinderObstacle(t,e,i){return Ht.x=t.x,Ht.y=t.y,Ht.z=t.z,this.navMesh.addCylinderObstacle(Ht,e,i)}addBoxObstacle(t,e,i){return Ht.x=t.x,Ht.y=t.y,Ht.z=t.z,Kt.x=e.x,Kt.y=e.y,Kt.z=e.z,this.navMesh.addBoxObstacle(Ht,Kt,i)}removeObstacle(t){this.navMesh.removeObstacle(t)}isSupported(){return void 0!==this.navmeshWasm}},ee=class{constructor(t,e,i){this.navmeshWasmWrapper=t,this.transforms=[],this.agents=new Array,this.reachRadii=new Array,this._agentDestinationArmed=new Array,this._agentDestination=new Array,this.crowd=new this.navmeshWasmWrapper.navmeshWasm.Crowd(e,i,this.navmeshWasmWrapper.navMesh.getNavMesh())}onReachTarget(t,e){}addAgent(t,e,i){let o=new this.navmeshWasmWrapper.navmeshWasm.dtCrowdAgentParams;o.radius=e.radius,o.height=e.height,o.maxAcceleration=e.maxAcceleration,o.maxSpeed=e.maxSpeed,o.collisionQueryRange=e.collisionQueryRange,o.pathOptimizationRange=e.pathOptimizationRange,o.separationWeight=e.separationWeight,o.updateFlags=7,o.obstacleAvoidanceType=0,o.queryFilterType=0,o.userData=0;let s=this.crowd.addAgent(new this.navmeshWasmWrapper.navmeshWasm.Vec3(t.x,t.y,t.z),o);return this.transforms.push(i),this.agents.push(s),this.reachRadii.push(e.reachRadius?e.reachRadius:e.radius),this._agentDestinationArmed.push(!1),this._agentDestination.push(new R(0,0,0)),s}getAgentPosition(t){return this.crowd.getAgentPosition(t)}getAgentPositionToRef(t,e){let i=this.crowd.getAgentPosition(t);e.set(i.x,i.y,i.z)}getAgentVelocity(t){return this.crowd.getAgentVelocity(t)}getAgentVelocityToRef(t,e){let i=this.crowd.getAgentVelocity(t);e.set(i.x,i.y,i.z)}getAgentNextTargetPath(t){return this.crowd.getAgentNextTargetPath(t)}getAgentNextTargetPathToRef(t,e){let i=this.crowd.getAgentNextTargetPath(t);e.set(i.x,i.y,i.z)}getAgentState(t){return this.crowd.getAgentState(t)}overOffmeshConnection(t){return this.crowd.overOffmeshConnection(t)}agentGoto(t,e){this.crowd.agentGoto(t,new this.navmeshWasmWrapper.navmeshWasm.Vec3(e.x,e.y,e.z));let i=this.agents.indexOf(t);i>-1&&(this._agentDestinationArmed[i]=!0,this._agentDestination[i].set(e.x,e.y,e.z))}agentTeleport(t,e){this.crowd.agentTeleport(t,new this.navmeshWasmWrapper.navmeshWasm.Vec3(e.x,e.y,e.z))}updateAgentParameters(t,e){let i=this.crowd.getAgentParameters(t);void 0!==e.radius&&(i.radius=e.radius),void 0!==e.height&&(i.height=e.height),void 0!==e.maxAcceleration&&(i.maxAcceleration=e.maxAcceleration),void 0!==e.maxSpeed&&(i.maxSpeed=e.maxSpeed),void 0!==e.collisionQueryRange&&(i.collisionQueryRange=e.collisionQueryRange),void 0!==e.pathOptimizationRange&&(i.pathOptimizationRange=e.pathOptimizationRange),void 0!==e.separationWeight&&(i.separationWeight=e.separationWeight),this.crowd.setAgentParameters(t,i)}removeAgent(t){this.crowd.removeAgent(t);let e=this.agents.indexOf(t);e>-1&&(this.agents.splice(e,1),this.transforms.splice(e,1),this.reachRadii.splice(e,1),this._agentDestinationArmed.splice(e,1),this._agentDestination.splice(e,1))}getAgents(){return this.agents}update(t){if(this.navmeshWasmWrapper.navMesh.update(),t<=.001)return;let e=1/60;{let i=Math.floor(t/e);i>10&&(i=10),i<1&&(i=1);let o=t/i;for(let t=0;t<i;t++)this.crowd.update(o)}for(let t=0;t<this.agents.length;t++){let e=this.agents[t],i=this.getAgentPosition(e);if(this.transforms[t].copy(i),this._agentDestinationArmed[t]){let o=i.x-this._agentDestination[t].x,s=i.z-this._agentDestination[t].z,r=this.reachRadii[t],n=this._agentDestination[t].y-this.reachRadii[t],a=this._agentDestination[t].y+this.reachRadii[t],h=o*o+s*s;i.y>n&&i.y<a&&h<r*r&&(this.onReachTarget(e,this._agentDestination[t]),this._agentDestinationArmed[t]=!1)}}}setDefaultQueryExtent(t){let e=new this.navmeshWasmWrapper.navmeshWasm.Vec3(t.x,t.y,t.z);this.crowd.setDefaultQueryExtent(e)}getDefaultQueryExtent(){return this.crowd.getDefaultQueryExtent()}getDefaultQueryExtentToRef(t){let e=this.crowd.getDefaultQueryExtent();t.set(e.x,e.y,e.z)}getCorners(t){let e,i=this.crowd.getCorners(t),o=i.getPointCount(),s=[];for(e=0;e<o;e++){let t=i.getPoint(e);s.push(new R(t.x,t.y,t.z))}return s}dispose(){this.crowd.destroy()}};i({setup:function(t){let{manager:e,camera:i}=t,o=!1,s=5,r=8,n=9,a="drag",h=e.page.data.publish.gameControlObject,c=null!==h?e.page.find(h):null,d=null;if(c)for(let t of c.data.events){if(t.data.disabled||"GameControl"!==t.data.type)continue;let i=c;for(;e.usePhysics&&null!==(i=i.parent)?.parent;)i.data.physics;t.data.collisionEnabled&&(e.needsCollisionDetection=!0),null===d&&(d=t.data)}if(c&&d&&(!0===c.data.visible||!0===c.data.physics.enabled)){o=o||d.camera===i.uuid||c.uuid===i.uuid;let h=new qt(c,t.renderer.domElement,d,t.eventContext.page.data.globalPhysics,e,c.uuid!==i.uuid&&d.camera===i.uuid,i,e.page,t.sharedAssets);e.gameControl=h,s=d.joystickPosLoc,r=d.joystickRotLoc,n=d.jumpTouchButtonLoc,a=d.rotByTouch,l&&d.touchControl&&(e.joystickToGameControls[s]="pos","walk"===d.moveMode&&(e.joystickToGameControls[n]="jmp"),"joystick"===a&&(e.joystickToGameControls[r]="rot"))}if(e.gameControl&&e.gameControl.data.navmesh.enabled){let i=e.gameControl.data;if(!e.navigationMeshWrapper){let o;e.navigationMeshWrapper=new te(e.usePhysics,t.isExport),o="sphere"===i.collider.type?2*i.collider.radius:i.collider.height,o=Math.floor(o/i.navmesh.ch-1),e.navigationMeshWrapper.init({...i.navmesh,walkableHeight:o},e.gameControl,t.eventContext)}}return o},createJoysticks:function(t,e,i){t.joystickToGameControls.forEach((o,s)=>{let r=document.body.appendChild(document.createElement("div")),[n,a,h]=t.eventManager.eventContext.publish.joystickSizeAndXYOffset[s],l=(e-5*n)/4+n,c={},d="jmp"===o,m=d?0:n;s<10?(s<5?c.top=m/2:c.bottom=m/2,c.left=m/2+s%5*l):10===s?(c.left=m/2,c.top=i/2):(c.right=m/2,c.top=i/2),c.top?c.top-=a[1]:c.bottom+=a[1],c.left?c.left+=a[0]:c.right-=a[0];for(let t in c)c[t]+="px";if(d){let e=r.appendChild(document.createElement("div"));Object.assign(e.style,c,{position:"absolute",width:n+"px",height:n+"px",backgroundColor:`rgba(255,255,255,${"show"===h?.4:0})`,zIndex:"9999",borderRadius:n+"px",border:"show"===h?"solid 2px rgba(0, 0, 0, .1)":"none",display:"flex",alignItems:"center",justifyContent:"center",touchAction:"none"});let i=n/16*16*.4;return"show"===h&&(e.innerHTML=`\n\t\t\t\t\t\t<svg width="${i}" height="${.4*n}" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t\t\t<path d="M2 10L8 4L14 10" stroke="black" stroke-opacity="40%" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t`),e.addEventListener("pointerdown",()=>{t.gameControl.movementState.jump=1,t.requestRender()}),e.addEventListener("touchend",t=>t.preventDefault()),void(t.joysticks[s]=[void 0,r])}let p={zone:r,mode:"static",position:c,size:n};"hide"===h&&(p.restOpacity=0);let u=gt.create(p);u.on("move",(e,i)=>{let s=t.gameControl;"pos"===o?i.force<.2?s.moveForce=0:(s.movementState.movePosZ=Math.sin(-i.angle.radian),s.movementState.movePosX=Math.cos(-i.angle.radian),i.force>1.2?s.movementState.run=1:s.movementState.run=0,i.force<.3?s.moveForce=(i.force-.2)/.1:s.moveForce=1):"rot"===o&&(i.force<.2?s.rotForce=0:(s.movementState.rotPosX=i.vector.y,s.movementState.rotPosY=-i.vector.x,i.force<.3?s.rotForce=(i.force-.2)/.1:s.rotForce=1)),t.requestRender()}),u.on("end",(e,i)=>{let s=t.gameControl;"pos"===o?(s.movementState.movePosZ=0,s.movementState.movePosX=0,s.moveForce=1):"rot"===o&&(s.movementState.rotPosX=0,s.movementState.rotPosY=0,s.rotForce=1)}),t.joysticks[s]=[u,r]})}}),M("game-controls");
|
|
1
|
+
import{a as t}from"./runtime-chunk-JABQRWT5.js";import"./runtime-chunk-GD4SGFHZ.js";import{c as e,d as i,f as o,g as s,i as r,k as n,l as a}from"./runtime-chunk-ZJIYRGBK.js";import"./runtime-chunk-N2ZRGNPR.js";import{a as h}from"./runtime-chunk-VAVYZ35B.js";import{e as l,f as c,g as d}from"./runtime-chunk-FQNSP44B.js";import{h as m}from"./runtime-chunk-KJQWLDYH.js";import"./runtime-chunk-RWYT7G6G.js";import{a as p}from"./runtime-chunk-AEPWABER.js";import"./runtime-chunk-TU4KDRKR.js";import"./runtime-chunk-JJVEXKEO.js";import"./runtime-chunk-32XVU5DS.js";import"./runtime-chunk-HOOQDTK7.js";import"./runtime-chunk-PWMK5MVJ.js";import"./runtime-chunk-ZFM73G2B.js";import{L as u,S as y,a as g,ea as f,q as v}from"./runtime-chunk-ZA3HZGIR.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{f as b,g as x}from"./runtime-chunk-33EF3BLM.js";import{d as w,h as P}from"./runtime-chunk-WYIK4MJQ.js";import"./runtime-chunk-RTLL6WIB.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-BFGZJ4LR.js";import{a as M}from"./runtime-chunk-TZCHGFVF.js";import{Ma as E,Na as j,Qa as S,da as A,f as T,ta as D}from"./runtime-chunk-F6XTFQMZ.js";import{$c as k,Dc as C,Ec as O,Fc as z,Gc as R,Hc as F,Qc as _,Rc as W,Te as X,Zc as N,fd as V,nd as L}from"./runtime-chunk-KPOUV3HD.js";import"./runtime-chunk-ML3Z74BL.js";var I=(t,e)=>{let i=e.x-t.x,o=e.y-t.y;return Math.sqrt(i*i+o*o)},Q=t=>t*(Math.PI/180),B=new Map,Z=(t,e,i)=>{let o,s=e.split(/[ ,]+/g);for(let e=0;e<s.length;e+=1)o=s[e],t.addEventListener?t.addEventListener(o,i,!1):t.attachEvent&&t.attachEvent(o,i)},Y=(t,e,i)=>{let o,s=e.split(/[ ,]+/g);for(let e=0;e<s.length;e+=1)o=s[e],t.removeEventListener?t.removeEventListener(o,i):t.detachEvent&&t.detachEvent(o,i)},G=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),q=()=>{if(!(typeof window>"u"))return{x:void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},U=(t,e)=>{e.top||e.right||e.bottom||e.left?(t.style.top=e.top,t.style.right=e.right,t.style.bottom=e.bottom,t.style.left=e.left):(t.style.left=e.x+"px",t.style.top=e.y+"px")},H=(t,e,i)=>{let o=K(t);for(let t in o)if(Object.prototype.hasOwnProperty.call(o,t))if("string"==typeof e)o[t]=e+" "+i;else{let s="";for(let t=0,o=e.length;t<o;t+=1)s+=e[t]+" "+i+", ";o[t]=s.slice(0,-2)}return o},K=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},J=(t,e)=>{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},$=(t,e)=>{if(t.length)for(let i=0,o=t.length;i<o;i+=1)e(t[i]);else e(t)};typeof window<"u"&&(tt="ontouchstart"in window,et=!!window.PointerEvent,it=!!window.MSPointerEvent);var tt,et,it,ot,st={start:"mousedown",move:"mousemove",end:"mouseup"},rt={};function nt(){}et?ot={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:it?ot={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:tt?(ot={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},rt=st):ot=st,nt.prototype.on=function(t,e){var i,o=this,s=t.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var r=0;r<s.length;r+=1)i=s[r],o._handlers_[i]=o._handlers_[i]||[],o._handlers_[i].push(e);return o},nt.prototype.off=function(t,e){var i=this;return i._handlers_=i._handlers_||{},void 0===t?i._handlers_={}:void 0===e?i._handlers_[t]=null:i._handlers_[t]&&i._handlers_[t].indexOf(e)>=0&&i._handlers_[t].splice(i._handlers_[t].indexOf(e),1),i},nt.prototype.trigger=function(t,e){var i,o=this,s=t.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var r=0;r<s.length;r+=1)i=s[r],o._handlers_[i]&&o._handlers_[i].length&&o._handlers_[i].forEach(function(t){t.call(o,{type:i,target:o},e)})},nt.prototype.config=function(t){var e=this;e.options=e.defaults||{},t&&(e.options=((t,e)=>{let i={};for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&Object.prototype.hasOwnProperty.call(e,o)?i[o]=e[o]:Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=t[o]);return i})(e.options,t))},nt.prototype.bindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[e]=function(){"function"==typeof i["on"+e]?i["on"+e].apply(i,arguments):console.warn('[WARNING] : Missing "on'+e+'" handler.')},Z(t,ot[e],i._domHandlers_[e]),rt[e]&&Z(t,rt[e],i._domHandlers_[e]),i},nt.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},Y(t,ot[e],i._domHandlers_[e]),rt[e]&&Y(t,rt[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var at=nt;function ht(t,e){return this.identifier=e.identifier,this.position=e.position,this.frontPosition=e.frontPosition,this.collection=t,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(e),"dynamic"===this.options.mode&&(this.options.restOpacity=0),this.id=ht.id,ht.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}ht.prototype=new at,ht.constructor=ht,ht.id=0,ht.prototype.buildEl=function(t){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},ht.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=(()=>{let t=K("borderRadius");for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e]="50%");return t})(),i=H("transition","opacity",t),o={};return o.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},o.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},o.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},J(o.el,i),"circle"===this.options.shape&&J(o.back,e),J(o.front,e),this.applyStyles(o),this},ht.prototype.applyStyles=function(t){for(var e in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,e))for(var i in t[e])this.ui[e].style[i]=t[e][i];return this},ht.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},ht.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},ht.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null},ht.prototype.show=function(t){var e=this;return e.options.dataOnly||(clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.addToDom(),e.restCallback(),setTimeout(function(){e.ui.el.style.opacity=1},0),e.showTimeout=setTimeout(function(){e.trigger("shown",e.instance),"function"==typeof t&&t.call(this)},e.options.fadeTime)),e},ht.prototype.hide=function(t){var e=this;if(e.options.dataOnly)return e;if(e.ui.el.style.opacity=e.options.restOpacity,clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.removeTimeout=setTimeout(function(){var i="dynamic"===e.options.mode?"none":"block";e.ui.el.style.display=i,"function"==typeof t&&t.call(e),e.trigger("hidden",e.instance)},e.options.fadeTime),e.options.restJoystick){let i=e.options.restJoystick,o={};o.x=!0===i||!1!==i.x?0:e.instance.frontPosition.x,o.y=!0===i||!1!==i.y?0:e.instance.frontPosition.y,e.setPosition(t,o)}return e},ht.prototype.setPosition=function(t,e){var i=this;i.frontPosition={x:e.x,y:e.y};var o=i.options.fadeTime+"ms",s={};s.front=H("transition",["top","left"],o);var r={front:{}};r.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(s),i.applyStyles(r),i.restTimeout=setTimeout(function(){"function"==typeof t&&t.call(i),i.restCallback()},i.options.fadeTime)},ht.prototype.restCallback=function(){var t=this,e={};e.front=H("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},ht.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},ht.prototype.computeDirection=function(t){var e,i,o,s=t.angle.radian,r=Math.PI/4,n=Math.PI/2;if(s>r&&s<3*r&&!t.lockX?e="up":s>-r&&s<=r&&!t.lockY?e="left":s>3*-r&&s<=-r&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=s>-n&&s<n?"left":"right"),t.lockX||(o=s>0?"up":"down"),t.force>this.options.threshold){var a,h={};for(a in this.direction)Object.prototype.hasOwnProperty.call(this.direction,a)&&(h[a]=this.direction[a]);var l={};for(a in this.direction={x:i,y:o,angle:e},t.direction=this.direction,h)h[a]===this.direction[a]&&(l[a]=!0);if(l.x&&l.y&&l.angle)return t;(!l.x||!l.y)&&this.trigger("plain",t),l.x||this.trigger("plain:"+i,t),l.y||this.trigger("plain:"+o,t),l.angle||this.trigger("dir dir:"+e,t)}else this.resetDirection();return t};var lt=ht;function ct(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=ct.id,ct.id+=1,i.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},i.config(e),("static"===i.options.mode||"semi"===i.options.mode)&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let o=getComputedStyle(i.options.zone.parentElement);return o&&"flex"===o.display&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}ct.prototype=new at,ct.constructor=ct,ct.id=0,ct.prototype.prepareNipples=function(){var t=this,e=t.nipples;e.on=t.on.bind(t),e.off=t.off.bind(t),e.options=t.options,e.destroy=t.destroy.bind(t),e.ids=t.ids,e.id=t.id,e.processOnMove=t.processOnMove.bind(t),e.processOnEnd=t.processOnEnd.bind(t),e.get=function(t){if(void 0===t)return e[0];for(var i=0,o=e.length;i<o;i+=1)if(e[i].identifier===t)return e[i];return!1}},ct.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},ct.prototype.begin=function(){var t=this,e=t.options;if("static"===e.mode){var i=t.createNipple(e.position,t.manager.getIdentifier());i.add(),t.idles.push(i)}},ct.prototype.createNipple=function(t,e){var i=this,o=i.manager.scroll,s={},r=i.options,n=i.parentIsFlex?o.x:o.x+i.box.left,a=i.parentIsFlex?o.y:o.y+i.box.top;if(t.x&&t.y)s={x:t.x-n,y:t.y-a};else if(t.top||t.right||t.bottom||t.left){var h=document.createElement("DIV");h.style.display="hidden",h.style.top=t.top,h.style.right=t.right,h.style.bottom=t.bottom,h.style.left=t.left,h.style.position="absolute",r.zone.appendChild(h);var l=h.getBoundingClientRect();r.zone.removeChild(h),s=t,t={x:l.left+o.x,y:l.top+o.y}}var c=new lt(i,{color:r.color,size:r.size,threshold:r.threshold,fadeTime:r.fadeTime,dataOnly:r.dataOnly,restJoystick:r.restJoystick,restOpacity:r.restOpacity,mode:r.mode,identifier:e,position:t,zone:r.zone,frontPosition:{x:0,y:0},shape:r.shape});return r.dataOnly||(U(c.ui.el,s),U(c.ui.front,c.frontPosition)),i.nipples.push(c),i.trigger("added "+c.identifier+":added",c),i.manager.trigger("added "+c.identifier+":added",c),i.bindNipple(c),c},ct.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},ct.prototype.bindNipple=function(t){var e,i=this,o=function(t,o){e=t.type+" "+o.id+":"+t.type,i.trigger(e,o)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",o),t.on("dir:up dir:right dir:down dir:left",o),t.on("plain:up plain:right plain:down plain:left",o)},ct.prototype.pressureFn=function(t,e,i){var o=this,s=0;clearInterval(o.pressureIntervals[i]),o.pressureIntervals[i]=setInterval(function(){var i=t.force||t.pressure||t.webkitForce||0;i!==s&&(e.trigger("pressure",i),o.trigger("pressure "+e.identifier+":pressure",i),s=i)}.bind(o),100)},ct.prototype.onstart=function(t){var e=this,i=e.options,o=t;return t=G(t),e.updateBox(),$(t,function(s){e.actives.length<i.maxNumberOfNipples?e.processOnStart(s):o.type.match(/^touch/)&&(Object.keys(e.manager.ids).forEach(function(i){if(Object.values(o.touches).findIndex(function(t){return t.identifier===i})<0){var s=[t[0]];s.identifier=i,e.processOnEnd(s)}}),e.actives.length<i.maxNumberOfNipples&&e.processOnStart(s))}),e.manager.bindDocument(),!1},ct.prototype.processOnStart=function(t){var e,i=this,o=i.options,s=i.manager.getIdentifier(t),r=t.force||t.pressure||t.webkitForce||0,n={x:t.pageX,y:t.pageY},a=i.getOrCreate(s,n);a.identifier!==s&&i.manager.removeIdentifier(a.identifier),a.identifier=s;var h=function(e){e.trigger("start",e),i.trigger("start "+e.id+":start",e),e.show(),r>0&&i.pressureFn(t,e,e.identifier),i.processOnMove(t)};if((e=i.idles.indexOf(a))>=0&&i.idles.splice(e,1),i.actives.push(a),i.ids.push(a.identifier),"semi"!==o.mode)h(a);else{if(!(I(n,a.position)<=o.catchDistance))return a.destroy(),void i.processOnStart(t);h(a)}return a},ct.prototype.getOrCreate=function(t,e){var i,o=this,s=o.options;return/(semi|static)/.test(s.mode)?(i=o.idles[0])?(o.idles.splice(0,1),i):"semi"===s.mode?o.createNipple(e,t):(console.warn("Coudln't find the needed nipple."),!1):i=o.createNipple(e,t)},ct.prototype.processOnMove=function(t){var e=this,i=e.options,o=e.manager.getIdentifier(t),s=e.nipples.get(o),r=e.manager.scroll;if((t=>isNaN(t.buttons)?0!==t.pressure:0!==t.buttons)(t)){if(!s)return console.error("Found zombie joystick with ID "+o),void e.manager.removeIdentifier(o);if(i.dynamicPage){var n=s.el.getBoundingClientRect();s.position={x:r.x+n.left,y:r.y+n.top}}s.identifier=o;var a=s.options.size/2,h={x:t.pageX,y:t.pageY};i.lockX&&(h.y=s.position.y),i.lockY&&(h.x=s.position.x);var l,c,d=I(h,s.position),m=((t,e)=>{let i=e.x-t.x,o=e.y-t.y;return(t=>t*(180/Math.PI))(Math.atan2(o,i))})(h,s.position),p=Q(m),u=d/a,y={distance:d,position:h};if("circle"===s.options.shape?(l=Math.min(d,a),c=((t,e,i)=>{let o={x:0,y:0};return i=Q(i),o.x=t.x-e*Math.cos(i),o.y=t.y-e*Math.sin(i),o})(s.position,l,m)):(c=((t,e,i)=>({x:Math.min(Math.max(t.x,e.x-i),e.x+i),y:Math.min(Math.max(t.y,e.y-i),e.y+i)}))(h,s.position,a),l=I(c,s.position)),i.follow){if(d>a){let t=h.x-c.x,i=h.y-c.y;s.position.x+=t,s.position.y+=i,s.el.style.top=s.position.y-(e.box.top+r.y)+"px",s.el.style.left=s.position.x-(e.box.left+r.x)+"px",d=I(h,s.position)}}else h=c,d=l;var g=h.x-s.position.x,f=h.y-s.position.y;s.frontPosition={x:g,y:f},i.dataOnly||U(s.ui.front,s.frontPosition);var v={identifier:s.identifier,position:h,force:u,pressure:t.force||t.pressure||t.webkitForce||0,distance:d,angle:{radian:p,degree:m},vector:{x:g/a,y:-f/a},raw:y,instance:s,lockX:i.lockX,lockY:i.lockY};(v=s.computeDirection(v)).angle={radian:Q(180-m),degree:180-m},s.trigger("move",v),e.trigger("move "+s.id+":move",v)}else this.processOnEnd(t)},ct.prototype.processOnEnd=function(t){var e=this,i=e.options,o=e.manager.getIdentifier(t),s=e.nipples.get(o),r=e.manager.removeIdentifier(s.identifier);!s||(i.dataOnly||s.hide(function(){"dynamic"===i.mode&&(s.trigger("removed",s),e.trigger("removed "+s.id+":removed",s),e.manager.trigger("removed "+s.id+":removed",s),s.destroy())}),clearInterval(e.pressureIntervals[s.identifier]),s.resetDirection(),s.trigger("end",s),e.trigger("end "+s.id+":end",s),e.ids.indexOf(s.identifier)>=0&&e.ids.splice(e.ids.indexOf(s.identifier),1),e.actives.indexOf(s)>=0&&e.actives.splice(e.actives.indexOf(s),1),/(semi|static)/.test(i.mode)?e.idles.push(s):e.nipples.indexOf(s)>=0&&e.nipples.splice(e.nipples.indexOf(s),1),e.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(e.manager.ids[r.id]=r.identifier))},ct.prototype.onDestroyed=function(t,e){var i=this;i.nipples.indexOf(e)>=0&&i.nipples.splice(i.nipples.indexOf(e),1),i.actives.indexOf(e)>=0&&i.actives.splice(i.actives.indexOf(e),1),i.idles.indexOf(e)>=0&&i.idles.splice(i.idles.indexOf(e),1),i.ids.indexOf(e.identifier)>=0&&i.ids.splice(i.ids.indexOf(e.identifier),1),i.manager.removeIdentifier(e.identifier),i.manager.unbindDocument()},ct.prototype.destroy=function(){var t=this;for(var e in t.unbindEvt(t.options.zone,"start"),t.nipples.forEach(function(t){t.destroy()}),t.pressureIntervals)Object.prototype.hasOwnProperty.call(t.pressureIntervals,e)&&clearInterval(t.pressureIntervals[e]);t.trigger("destroyed",t.nipples),t.manager.unbindDocument(),t.off(),t.pressureIntervals={},t.nipples=[],t.idles=[],t.actives=[],t.ids=[],t.manager=null};var dt=ct;function mt(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=q(),e._windowBound=!1,e.config(t),e.prepareCollections();var i=function(){var t;e.collections.forEach(function(i){i.forEach(function(i){t=i.el.getBoundingClientRect(),i.position={x:e.scroll.x+t.left,y:e.scroll.y+t.top}})})};return e._onResize=function(){(t=>{B.has(t)&&clearTimeout(B.get(t)),B.set(t,setTimeout(function(){B.delete(t),t()},100))})(i)},e._onScroll=function(){e.scroll=q()},e.collections}mt.prototype=new at,mt.constructor=mt,mt.prototype.prepareCollections=function(){var t=this;t.collections.create=t.create.bind(t),t.collections.on=t.on.bind(t),t.collections.off=t.off.bind(t),t.collections.destroy=t.destroy.bind(t),t.collections.get=function(e){var i;return t.collections.every(function(t){return!(i=t.get(e))}),i}},mt.prototype.create=function(t){return this.createCollection(t)},mt.prototype.bindWindowEvents=function(){var t=this;t._windowBound||typeof window>"u"||(t._windowBound=!0,Z(window,"resize",t._onResize),Z(window,"scroll",t._onScroll))},mt.prototype.unbindWindowEvents=function(){var t=this;!t._windowBound||typeof window>"u"||(t._windowBound=!1,Y(window,"resize",t._onResize),Y(window,"scroll",t._onScroll))},mt.prototype.createCollection=function(t){var e=this,i=new dt(e,t);return e.bindCollection(i),e.collections.push(i),e.bindWindowEvents(),i},mt.prototype.bindCollection=function(t){var e,i=this,o=function(t,o){e=t.type+" "+o.id+":"+t.type,i.trigger(e,o)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",o),t.on("dir:up dir:right dir:down dir:left",o),t.on("plain:up plain:right plain:down plain:left",o)},mt.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},mt.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||!0===t)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},mt.prototype.getIdentifier=function(t){var e;return t?void 0===(e=void 0===t.identifier?t.pointerId:t.identifier)&&(e=this.latest||0):e=this.index,void 0===this.ids[e]&&(this.ids[e]=this.index,this.index+=1),this.latest=e,this.ids[e]},mt.prototype.removeIdentifier=function(t){var e={};for(var i in this.ids)if(this.ids[i]===t){e.id=i,e.identifier=this.ids[i],delete this.ids[i];break}return e},mt.prototype.onmove=function(t){return this.onAny("move",t),!1},mt.prototype.onend=function(t){return this.onAny("end",t),!1},mt.prototype.oncancel=function(t){return this.onAny("end",t),!1},mt.prototype.onAny=function(t,e){var i,o=this,s="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=G(e);var r=function(t,e,i){i.ids.indexOf(e)>=0&&(i[s](t),t._found_=!0)};return $(e,function(t){i=o.getIdentifier(t),$(o.collections,r.bind(null,t,i)),t._found_||o.removeIdentifier(i)}),!1},mt.prototype.destroy=function(){var t=this;t.unbindDocument(!0),t.unbindWindowEvents(),t.ids={},t.index=0,t.collections.forEach(function(t){t.destroy()}),t.collections=[],t.off()},mt.prototype.onDestroyed=function(t,e){var i=this;if(i.collections.indexOf(e)<0)return!1;i.collections.splice(i.collections.indexOf(e),1),0===i.collections.length&&i.unbindWindowEvents()};var pt=mt,ut=null;function yt(){return ut||(ut=new pt),ut}var gt={create:function(t){return yt().create(t)},destroy:function(){ut&&(ut.destroy(),ut=null)},get factory(){return yt()}},ft=.02,vt=new F,bt=new F,xt=new F,wt=new F,Pt=new F,Mt=new F,Et=new _,jt=new _,St=new _,At=new R,Tt=new R,Dt=new W(0,0,0,"YXZ"),kt=new F(1,0,0),Ct=new F(0,1,0),Ot=new F(0,0,1),zt=new F(1,1,1),Rt=[],Ft=t=>Rt[t]??(Rt[t]=new F),_t=new F,Wt=new F,Xt=new F,Nt=new F,Vt=new R,Lt=new F,It=new R,Qt=new X,Bt=new N,Zt={type:"requestRender"},Yt={type:"updateMatrix"},Gt=class extends C{constructor(t,i,o,s,r,n,a,h,u){super(),this.object=t,this.domElement=i,this.data=o,this.gloabalPhysics=s,this.controlsManager=r,this.cameraFollow=n,this.camera=a,this.page=h,this.sharedAssets=u,this.enableDamping=!0,this.target0=new F,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=e,this.euler0=new W(0,0,0,"YXZ"),this.shearMatrix0=new _,this.cameraShearMatrix0=new _,this.position0Cam=new F,this.quat0Cam=new R,this.scale0Cam=new F,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new X(new F(0,-40,0),new F(0,40,0)),matrix:new _,position:new F,rotation:new R},this.euler=new W(0,0,0,"YXZ"),this.eulerDelta=new F,this.lastPosition=new F,this.lastCameraQuaternion=new R,this.lastCameraPosition=new F,this.PI_2=Math.PI/2,this.prevMouse=new z,this.velocityTarget=new F,this.velocity=new F,this.directionXZ=new F,this.rotVelocityStick=new F,this.rotVelocityTarget=new F,this.rotVelocity=new F,this.rotDirection=new F,this.nonColliderRotOffset=new _,this.nonColliderPosOffset=new _,this.firstPointerId=-1,this.rot=new F,this.path=[],this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.onObject=!1,this.actionState={},this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]],this.collisionEnabled=!0,this.offsetMatrix=new _,this.objectToTarget=new F,this.objectToTarget0=new F,this.objectToCamXZ=new F,this.objectToCamXZ0=new F,this.targetToCamera=new F,this.targetToCamera0=new F,this.cameraPolarAxis0=new F,this.targetPos=new F,this.targetQuat=new R,this.lerpFactorPos=(new F).setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new R,this.objXZQuatInv=new R,this.objXZRotMat=new _,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new F,this.pushedVelocity=new F,this.groundYRotation=0,this.objectRealQuat=new R,this.colliderWorldQuat=new R,this.groundNormal=new F,this.groundTilt=new R,this.groundTiltInv=new R,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new F,this.quaternion=new R,this.scale=new F,this.initialAction=!0,this.onPointerDown=t=>{!(t.target===this.domElement||t.target instanceof HTMLElement&&"SPLINE-VIEWER"===t.target.tagName&&t.target.shadowRoot?.contains(this.domElement))||-1!==this.firstPointerId||(this.firstPointerId=t.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),"keys"!==this.rotBy&&!l&&!c&&this.domElement.requestPointerLock(),this.prevMouse.set(t.clientX,t.clientY))},this.onPointerUp=t=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),"mouse"===t.pointerType&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=t=>{if(t.pointerId!==this.firstPointerId)return;let e=t.clientX-this.prevMouse.x,i=t.clientY-this.prevMouse.y;this.prevMouse.set(t.clientX,t.clientY),"mouse"===t.pointerType&&"keys"!==this.rotBy&&(c&&d<15.5&&!l?(this.eulerDelta.y=-e*this.mouseOrbitSensitivity,this.eulerDelta.x=-i*this.mouseOrbitSensitivity):(this.eulerDelta.y=-t.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-t.movementY*this.mouseOrbitSensitivity)),"mouse"!==t.pointerType&&"drag"===this.rotByTouch&&(this.eulerDelta.y=-e*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-i*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=t=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?Gt.isLocked=!0:Gt.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let t in this.movementState)this.movementState[t]=0},this.onKeyDown=t=>{!(t.target instanceof HTMLInputElement)&&("ArrowLeft"===t.code||"ArrowUp"===t.code||"ArrowRight"===t.code||"ArrowDown"===t.code||"Space"===t.code)&&t.preventDefault();for(let e of this.keyAssignments)if(t.key.toUpperCase()===e[1]||t.key===e[1]){this.movementState[e[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=t=>{for(let e of this.keyAssignments)if(t.key.toUpperCase()===e[1]||t.key===e[1]||t.code.slice(3,t.code.length).toUpperCase()===e[1]){this.movementState[e[0]]=0;break}},this.copyVRGamePadValues=(t,e)=>{for(let i=2;i<4;i++){let o=t.axes[i];0===e?2===i?this.movementState.movePosX=o:this.movementState.movePosZ=o:(t.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,2===i?this.movementState.rotPosY=o:"fly"===this.moveMode&&(this.movementState.moveNegY=o))}},this.sharedGameControlGlobals=r.sharedGameControlGlobals,t===a&&(this.isFirstPerson=!0),this.object.parent instanceof m||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),this.shearMatrix0.copy(this.object.shearMatrix),S(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix}),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let g=this.euler0.clone(),f=g.y;if(this.objectRealQuat.copy(this.quaternion),g.y=0,this.quaternion.setFromEuler(g),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),g.set(0,f,0),this.quaternion.setFromEuler(g),this.rot.setFromEuler(g),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||!0===this.cameraFollow)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),!0===this.cameraFollow){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.camera.parent instanceof m||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),this.cameraShearMatrix0.copy(this.camera.shearMatrix),S(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix})),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let t,e=new F(0,0,-1).applyQuaternion(this.camera.quaternion),i=(new F).subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(i),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(e.y)<1e-6?(i.y=0,e.y=0,t=i.projectOnVector(e)):t=i.y/e.y>0?e.multiplyScalar(i.y/e.y):e.multiplyScalar(i.length()),this.targetToCamera0.copy(t).negate();let o=this.camera.position.clone().add(t);this.objectToTarget0.subVectors(o,this.position);let s=(new W).setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-s.x,s.x=0,s.z=0,s.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(s)}if(this.object instanceof p&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=o.rotByTouch??"joystick",this.rotBy=o.rotBy??"keys",this.rotationMode=o.rotationMode??"normal",this.moveMode=o.moveMode??"walk",this.collisionEnabled=o.collisionEnabled,this.speedTranslate=1*(o.speedTranslate??250),this.speedOrbit=.025*(o.speedRotate??100),this.mouseOrbitSensitivity=16e-6*(o.speedRotate??100),this.keyAssignments=o.keyAssignments.map(t=>{let e=[t[0],t[1]];return"▲"===e[1]?e[1]="ArrowUp":"◀"===e[1]?e[1]="ArrowLeft":"▼"===e[1]?e[1]="ArrowDown":"▶"===e[1]?e[1]="ArrowRight":"⇧"===e[1]?e[1]="Shift":"↵"===e[1]?e[1]="Enter":"Space"===e[1]?e[1]=" ":"⌘"===e[1]?e[1]="Meta":"Ctrl"===e[1]?e[1]="Control":"Esc"===e[1]&&(e[1]="Escape"),e}),"mouse"===o.rotBy){let t;t=this.keyAssignments.findIndex(t=>"rotNegX"===t[0]),-1!==t&&(this.keyAssignments[t][1]=""),t=this.keyAssignments.findIndex(t=>"rotPosX"===t[0]),-1!==t&&(this.keyAssignments[t][1]=""),t=this.keyAssignments.findIndex(t=>"rotPosY"===t[0]),-1!==t&&(this.keyAssignments[t][1]=""),t=this.keyAssignments.findIndex(t=>"rotNegY"===t[0]),-1!==t&&(this.keyAssignments[t][1]="")}this.lerpFactorPosStart=1-.02**(1/(60*(o.delayPos[0]??.3))),this.lerpFactorPosEnd=1-.02**(1/(60*(o.delayPos[1]??.3))),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/(60*(o.delayRot[0]??.3))),this.lerpFactorRotEnd=1-.02**(1/(60*(o.delayRot[1]??.3))),this.lerpFactorPosCamera=1-.02**(1/(60*(o.delayPosCamera??.3))),this.lerpFactorRotCamera=1-.02**(1/(60*(o.delayRotCamera??.3))),this.gravity=12*(this.gloabalPhysics.gravity??D.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??D.defaultData.usePhysics,this.jumpPower=20*o.jumpPower,this.resetYPosition=this.position.y+Math.abs(o.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=o.alignToGround??!1,this.orientMode=o.autoOrientMove?o.orientMode:"none",this.orientWith=o.orientWith??j.defaultDataThirdPerson.orientWith,this.slopeThresh=65*Math.PI/180,"capsule"===o.collider.type?(this.collider.radius=o.collider.radius,this.collider.segment.start.y=o.collider.height/2-o.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=o.collider.height*ft/this.pixelsPerMeter,this.stepThresh=.3*o.collider.height/this.pixelsPerMeter,this.colliderHeight=o.collider.height):"sphere"===o.collider.type?(this.collider.radius=o.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*o.collider.radius*ft/this.pixelsPerMeter,this.stepThresh=2*o.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*o.collider.radius):(this.offset=o.collider.height*ft/this.pixelsPerMeter,this.stepThresh=.3*o.collider.height/this.pixelsPerMeter,this.colliderHeight=o.collider.height),this.collider.type=o.collider.type;let b=(new F).fromArray(o.collider.position.map(t=>"number"==typeof t?t:0)),x=(new R).setFromEuler((new W).fromArray([...o.collider.rotation.map(t=>"number"==typeof t?t:0),"XYZ"]));this.collider.position.copy(b).multiply(this.scale),this.collider.rotation.copy(x),this.collider.matrix.compose(b,x,zt),void 0!==o.cameraXAxis&&(this.cameraXAxis=o.cameraXAxis,this.cameraYAxis=o.cameraYAxis,this.minPolarAngle=o.cameraRotXLimits[0],this.maxPolarAngle=o.cameraRotXLimits[1],this.minAzimuthAngleRel=o.cameraRotYLimits[0],this.maxAzimuthAngleRel=o.cameraRotYLimits[1]),this.forwardDir=o.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=o.runMultiplier??2;let w=2*o.navmesh.destinationHelperRadius;if(w>0){let t=new T;t.push({fi:0,data:{...A.defaultData("light","phong"),alpha:0},id:"layer1"}),t.push({fi:0,data:{...A.defaultData("color"),color:o.navmesh.destinationHelperColor,alpha:o.navmesh.destinationHelperColor.a},id:"layer2"});let e=y({layers:t},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new L(v.create({parameters:{width:w,height:w/10,hollow:.7}}),e),this.navMeshPathDest.material.userData.opacity0=o.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.matrixWorldAutoUpdate=!0,this.camera.matrixWorldAutoUpdate=!0,this.object.shearMatrix.copy(this.shearMatrix0),t){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.parent instanceof m||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),S(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix});let t=(new W).setFromQuaternion(this.quaternion,"YXZ"),e=t.y;this.objectRealQuat.copy(this.quaternion),t.y=0,this.quaternion.setFromEuler(t),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),t.set(0,e,0),this.quaternion.setFromEuler(t),this.rot.setFromEuler(t),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof p?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();!0===this.cameraFollow&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.shearMatrix.copy(this.cameraShearMatrix0),t?(this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.camera.parent instanceof m||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),S(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix}))):this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let t=this.data,e=this.sharedAssets;void 0!==t.gameActions&&(this.actions={},E.list.forEach(i=>{this.actions[i]=b({...t,disabled:!1,type:"GameControl"},t.gameActions[i],this.page,e,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),x(this.actions.idle),x(this.actions.move),x(this.actions.run),x(this.actions.jump)}dispatchStartEvent(t){void 0!==this.actions[t]&&(this.actionState[t]||(this.actionState[t]=!0,this.actions[t].Transition.forEach(t=>{t.play()}),this.actions[t].Animation.forEach(t=>{t.play(!1===this.initialAction)}),this.actions[t].TimelineAnimation.forEach(t=>{t.play()}),this.actions[t].Create.forEach(t=>{t.dispatchStart()}),this.actions[t].Audio.forEach(t=>{t.dispatchGameControl("start")}),this.actions[t].Particles.forEach(t=>{t.dispatchGameControl("start")})))}dispatchStopEvent(t){void 0!==this.actions[t]&&(!this.actionState[t]||(this.actionState[t]=!1,this.actions[t].Transition.forEach(t=>{t.stop(),null!==t.object.currentState&&t.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[t].TimelineAnimation.forEach(t=>{t.stop()}),this.actions[t].Create.forEach(t=>{t.dispatchStop()}),this.actions[t].Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.actions[t].Particles.forEach(t=>{t.dispatchGameControl("stop")})))}get colliderWorldPosition(){return wt.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(t){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let e=(this.isFirstFrame?16.6:t)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*e,o=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let t=Pt.set(0,(0===this.velocity.y?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*e,0).divideScalar(this.pixelsPerMeter),i=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,t,this.object.rigidBody?.collider(0).shape,0,1,!1,8,void 0,void 0,this.object.rigidBody);if(i){this.onObject=!0,this.groundNormal.set(i.normal2.x,i.normal2.y,i.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(o=!0),0===i.collider.parent()?.bodyType()&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let t=i.collider.parent(),s=null!==t&&t.isKinematic()?t:null,r=null===s?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(s.handle);if(null!==s&&r?.userData.isFollowingObj!==this.object.uuid){let t=this.object.getWorldPosition(wt).add(this.collider.position).divideScalar(this.pixelsPerMeter),i=s.velocityAtPoint(t);this.groundVelocity.set(i.x,i.y,i.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=s.angvel().y*e}}else this.onObject=!1}if("walk"===this.moveMode&&this.collisionEnabled&&(1===this.movementState.jump&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*i),"fly"===this.moveMode&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,"+z"===this.forwardDir&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let t=this.navMeshPathDest.material;if("walk"===this.moveMode&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let e=wt.subVectors(this.path[1],this.position),i=Pt.subVectors(this.path[1],this.path[0]);e.dot(i)<0?this.path.shift():(this.directionXZ.x=i.x,this.directionXZ.z=i.z),t.opacity=t.userData.opacity0}else t.opacity-=.05*t.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,("walk"===this.moveMode?this.velocityTarget.x+this.velocityTarget.z===0:0===this.velocityTarget.manhattanLength())?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),"walk"===this.moveMode&&(this.lerpFactorPos.y=1),!1===this.didHit&&0===this.pushedVelocity.manhattanLength()||!1===this.usePhysics?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**i),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**i),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**i)):this.velocity.copy(this.velocityTarget),("walk"===this.moveMode?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||"fly"===this.moveMode)&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let r=xt.copy(this.velocity);if("none"!==this.orientMode&&!1===this.isFirstPerson){let t=Pt.copy(r);t.y=0,r.set(0,r.y,t.length()*("+z"===this.forwardDir?1:-1))}if(this.directionXZ.manhattanLength()>0&&"none"!==this.orientMode&&!1===this.isFirstPerson)if("camera"===this.orientWith&&this.path.length<=1){let t=wt;this.camera.getWorldDirection(t);let e=Mt.copy(Ct).multiplyScalar(t.dot(Ct));t.sub(e);let i=Pt.copy(this.directionXZ);i.x*=-1,this.rot.y=t.angleTo(i)*(t.cross(i).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*("+z"===this.forwardDir?1:-1);if(Dt.setFromVector3(this.rot),"walk"===this.moveMode&&(Dt.x=0),r.applyEuler(Dt),o&&(Tt.setFromUnitVectors(Ct,this.groundNormal),r.applyQuaternion(Tt)),!0===this.usePhysics&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let t=0;for(let i of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(void 0===i.rigidBody||void 0===i.prevQ)continue;(i.hasNonUniformScale?i.matrixWorldRigid:i.matrixWorld).decompose(_t,Vt,Wt);let o=this.object.getWorldPosition(Xt).add(this.collider.position).sub(_t);It.copy(i.prevQ).invert().premultiply(Vt);let n=Mt.subVectors(_t,i.prevT).add(Nt.copy(o).applyQuaternion(It).sub(o)).divideScalar(e).divideScalar(this.pixelsPerMeter),a=i.rigidBody.collider(0).castCollider(n,this.object.rigidBody.collider(0),wt.copy(r).divideScalar(this.pixelsPerMeter),0,e,!1);n.multiplyScalar(this.pixelsPerMeter);let h=P.is(i)?i:i.object;if(null!==a&&this.lastHitObj!==h){let t;i instanceof f&&(t=i);let e=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(e)for(let i of e)"character"===i.data.target&&(i.dispatch(t),h.dispatchEvent(s));this.lastHitObj=h}null!==a&&(Math.abs(n.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=n.x),Math.abs(n.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=n.y),Math.abs(n.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=n.z),Ft(t++).copy(a.normal1).applyQuaternion(i.quaternion))}if(t>0){for(let e=0;e<t;e++){let t=Ft(e),i=t.dot(r);i<0&&r.addScaledVector(t,-i)}r.add(this.pushedVelocity)}else r.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),"normal"===this.rotationMode&&(this.movementState.rotPosX||this.movementState.rotNegX)||"steer"===this.rotationMode&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||"walk"===this.moveMode)?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,"normal"===this.rotationMode&&(this.movementState.rotPosY||this.movementState.rotNegY)||"steer"===this.rotationMode&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(e),this.rotVelocityStick),0===this.rotVelocityTarget.manhattanLength()?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**i):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**i),this.euler.x+=this.rotVelocity.x*e,this.euler.y+=this.rotVelocity.y*e+this.groundYRotation,0===this.rotVelocityTarget.y&&0===this.directionXZ.manhattanLength()?this.rotationAccumWhenOrientWithCamera=0:(!1===this.cameraFollow||"Locked"===this.cameraYAxis)&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*e),!1===this.isFirstPerson&&"none"!==this.orientMode&&this.directionXZ.manhattanLength()>0){if("radial"===this.orientMode){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(Ct,this.euler.y-this.euler0.y);let t=Pt.copy(this.objectToCamXZ).normalize(),i=Mt.copy(r).multiplyScalar(e);i.y=0;let o=i.sub(wt.copy(t).multiplyScalar(i.dot(t))).cross(t).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*e+this.groundYRotation,0!==this.rotVelocityTarget.y&&(!1===this.cameraFollow||"Locked"===this.cameraYAxis)&&(this.euler.y=this.rot.y);if(!0===this.cameraFollow&&("walk"===this.moveMode?"Limit"===this.cameraXAxis?this.euler.x=O.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=O.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):"Limit"===this.cameraXAxis&&(this.euler.x=O.clamp(this.euler.x,-this.PI_2,this.PI_2))),"fly"===this.moveMode?this.rot.x=this.euler.x:this.isFirstPerson&&(Dt.copy(this.euler),Dt.y=0,this.nonColliderRotOffset.makeRotationFromEuler(Dt)),At.setFromAxisAngle(kt,this.rot.x),Tt.setFromAxisAngle(Ct,this.rot.y),Tt.multiply(At),At.setFromAxisAngle(Ot,this.rot.z),Tt.multiply(At),this.quaternion.copy(Tt),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let t=Pt.copy(r).multiplyScalar(e/this.pixelsPerMeter),i=null;this.didHit=!1;let o=new F;for(let e=0;e<5;e++){let r=t.length(),n=Mt.copy(t).normalize();if(i=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,n,this.object.rigidBody.collider(0).shape,0,r,!1,12,void 0,void 0,this.object.rigidBody),null===i){0===e&&0!==this.directionXZ.manhattanLength()&&(this.lastHitObj=null),o.add(t);break}{this.didHit=!0;let a=this.sharedGameControlGlobals.colliderToEntity.get(i.collider.handle);if(a!==this.lastHitObj&&0===e){this.lastHitObj=a;let t=this.sharedGameControlGlobals.entityToCollisionEvents[a?.uuid];if(t)for(let e of t)if("character"===e.data.target){let t,o=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i.collider.handle))._parent;if(a.cloner)for(let e of a.cloner.children)if(e.rigidBody===o){t=e;break}e.dispatch(t),a.dispatchEvent(s)}}let h=vt.set(i.normal2.x,i.normal2.y,i.normal2.z).applyQuaternion(this.colliderWorldQuat),l=bt.copy(n).multiplyScalar(i.time_of_impact).dot(h),c=i.time_of_impact;if(0===c&&(this.position.y+=this.offset*this.pixelsPerMeter),l>this.offset&&(c=i.time_of_impact*(l-this.offset)/l,o.addScaledVector(n,c)),t.copy(n).multiplyScalar(r-c),Math.acos(-h.y)>this.slopeThresh){let e=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),s=Mt.copy(i.witness2).applyQuaternion(this.colliderWorldQuat);s.y=0;let r=e.add(s);r.y+=this.stepThresh;let n=this.sharedGameControlGlobals.rapierWorld.castShape(r,this.colliderWorldQuat,t,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);null!==n&&0===n.time_of_impact&&(h.y=0,h.normalize())}t.addScaledVector(h,-t.dot(h))}}this.position.addScaledVector(o,this.pixelsPerMeter),wt.copy(this.position).divideScalar(this.pixelsPerMeter),At.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let n=this.object.rigidBody,a=void 0!==n&&Lt.copy(wt).sub(n.translation()).lengthSq()>1;void 0!==n&&(a?(n.setTranslation(wt,!0),n.setRotation(At,!0)):(n.setNextKinematicTranslation(wt),n.setNextKinematicRotation(At)))}else{let t=this.onObject?1:5,i=r.multiplyScalar(e/t);for(let o=0;o<t;o++)this.position.add(i),this.collisionAdjustment(e/t)}else this.position.addScaledVector(r,e);if("walk"===this.moveMode&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),w(this.position,this.quaternion,this.object.shearMatrix,this.scale,this.object.matrix).multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.object.parent instanceof m?this.object.matrixWorld.multiplyMatrices(this.object.parent.matrixWorld,this.object.matrix).multiply(this.object.pivotMatrix):this.object.matrixWorld.copy(this.object.matrix),this.object.children.forEach(t=>{t.updateMatrixWorld(!0)}),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),!0===this.cameraFollow){this.updateFollowArms();let t=this.objectToTarget.add(this.position),e=this.targetToCamera.add(t);Et.lookAt(e,t,Ct).setPosition(e),Et.decompose(this.targetPos,this.targetQuat,wt),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**i),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**i),this.camera.updateMatrix(),this.camera.matrixWorld.copy(this.camera.matrix),"Limit"===this.cameraYAxis&&"cartesian"===this.orientMode&&(this.euler.y=O.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=O.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(Yt),!(this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(void 0===this.camera||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&("fly"===this.moveMode||!0===this.onObject||!1===this.collisionEnabled)&&(null===this.navMeshPathDest||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)||(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(Zt),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=At.setFromAxisAngle(Ct,"Limit"===this.cameraYAxis&&"radial"!==this.orientMode?O.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);("Locked"!==this.cameraYAxis||"radial"===this.orientMode)&&this.objectToTarget.applyQuaternion(e),t="Limit"===this.cameraXAxis?O.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):O.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=wt.copy(this.cameraPolarAxis0);("Locked"!==this.cameraYAxis||"radial"===this.orientMode)&&i.applyQuaternion(e);let o=Tt.setFromAxisAngle(i,t);"Locked"!==this.cameraYAxis&&this.targetToCamera.applyQuaternion(e),"Locked"!==this.cameraXAxis&&this.targetToCamera.applyQuaternion(o)}groundTiltAdjustment(t){180*Ct.angleTo(t)/Math.PI<15||180*Ct.angleTo(t)/Math.PI>85?At.identity():At.setFromUnitVectors(Ct,t),this.groundTilt.slerp(At,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=bt.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=Et.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(wt,At,Pt).compose(wt,At,zt);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(t=>{if(t===this.object||t.isDescendantOf(this.object)||!t.bvhGeometry||!t.bvhGeometry.boundsTree)return;Bt.makeEmpty(),t.updateMatrixWorldRigid();let o=t.matrixWorldRigid,s=jt.copy(o).invert(),r=St.copy(jt).multiply(i);Qt.copy(this.collider.segment),Qt.start.applyMatrix4(r),Qt.end.applyMatrix4(r);let n=vt.copy(this.position).applyMatrix4(s);Bt.expandByPoint(Qt.start),Bt.expandByPoint(Qt.end),Bt.min.addScalar(-this.collider.radius),Bt.max.addScalar(this.collider.radius),t.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:t=>t.distanceToPoint(Qt.end),intersectsBounds:t=>t.intersectsBox(Bt),intersectsTriangle:t=>{let i=wt,s=Pt,r=t.closestPointToSegment(Qt,i,s);if(r<this.collider.radius){let t=this.collider.radius-r,a=s.sub(i).normalize(),h=Mt.copy(n);h.addScaledVector(a,t);let l=h.applyMatrix4(o).sub(this.position);e.add(l),Qt.start.addScaledVector(a,t),Qt.end.addScaledVector(a,t)}}})}),Bt.makeEmpty(),Qt.copy(this.collider.segment),Qt.start.applyMatrix4(i),Qt.end.applyMatrix4(i),Bt.expandByPoint(Qt.start),Bt.expandByPoint(Qt.end),Bt.min.addScalar(-this.collider.radius),Bt.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:t=>t.distanceToPoint(Qt.end),intersectsBounds:t=>t.intersectsBox(Bt),intersectsTriangle:t=>{let i=wt,o=Pt,s=t.closestPointToSegment(Qt,i,o);if(s<this.collider.radius){let t=this.collider.radius-s,r=o.sub(i).normalize();this.alignToGround&&this.groundTiltAdjustment(r),e.addScaledVector(r,t),Qt.start.addScaledVector(r,t),Qt.end.addScaledVector(r,t)}}}),this.onObject=Math.abs(e.y)>Math.abs(t*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let o=Math.max(0,e.length()-1e-5);e.normalize().multiplyScalar(o),this.position.add(e)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},qt=Gt;qt.isLocked=!1;var Ut,Ht,Kt,Jt={cs:6,ch:2,walkableSlopeAngle:90,walkableHeight:20,walkableClimb:5,walkableRadius:0,maxEdgeLen:12,maxSimplificationError:1.3,minRegionArea:8,mergeRegionArea:20,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1};n.then(t=>{Ut=t,Ht=new t.Vec3,Kt=new t.Vec3});var $t=new F,te=class{constructor(e=!1,i=!1){var s;this.usePhysics=e,this.isExport=i,this.onPointerDown=t=>{if(1!==h.length)return;let{raycaster:e,page:i}=this.eventContext;this.eventContext.updateRaycaster(t);let o=i.raycastWithClones(e);if(0!==o.length){if(this.gameControl){let t=$t.copy(this.gameControl.colliderWorldPosition);t.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(t,o[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(e,i)=>s=>{let n;if(s instanceof t){if(!s.objectForSample)return!0===s.object.dataPatched.physics.fusedBody&&"dynamic"===s.object.dataPatched.physics.rigidBody||void 0;if(s.objectForSample.dataPatched.physics.fusedBody)return;n=s.object}else if(s instanceof f)n=s.object;else if(n=s,!1===n.dataPatched.cloner?.disabled&&n.dataPatched.cloner?.hideBase&&!0!==n.dataPatched.physics?.fusedBody)return!0;if(i&&!n.userData.navmesh)return;let a=n.dataPatched;if(!a.visible&&!0!==a.physics?.enabled)return!0;s.updateMatrixWorldRigid();let h=r(a),l=n.userData.hasDestroy,c=n.userData.hasDrag,d=!1,m=!1;for(let t of a.events)!0!==t.data.disabled&&("GameControl"===t.data.type?d=!0:"Follow"===t.data.type&&(m=!0));if(d||h||m||l||c)return!0;if(this.usePhysics&&"dynamic"===a.physics?.rigidBody){if(this.usePhysics&&a.physics?.fusedBody)return!0}else if("geometry"in s&&s.geometry&&e.push(o(s.geometry,s.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return s.traverseObject((i,s)=>{if(0===s)return;let r;if(i instanceof t){if(!i.objectForSample)return!0===i.object.dataPatched.physics.fusedBody&&"dynamic"===i.object.dataPatched.physics.rigidBody||void 0;if(i.objectForSample.dataPatched.physics.fusedBody)return;r=i.object}else if(i instanceof f)r=i.object;else if(r=i,i.dataPatched.cloner?.hideBase)return!0;let n=r.dataPatched;if(!n.visible&&!0!==n.physics?.enabled)return!0;"geometry"in i&&i.geometry&&e.push(o(i.geometry,i.matrixWorld))}),!0},this.traverseNoPhysics=(e,i)=>s=>{let n;if(s instanceof t)return;n=s instanceof f?s.object:s;let a=n.dataPatched;if("visibility"===a.physics.enabled?!a.visible:!a.physics.enabled)return!0;if(i&&!n.userData.navmesh)return;let h=s.geometry,l=!0===n.userData.hasDestroy,c=!0===n.userData.hasDrag;if(r(a)||l||c||n.dataPatched.events.some(t=>!0!==t.data.disabled&&"GameControl"===t.data.type))return!0;h&&e.push(o(h,s.matrixWorld))},this.navmeshWasm=Ut,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(i?(s=a??"https://cdn.spline.design/@splinetool/runtime@2.0.94/build/",`\n(async function() {\n\tconst [wasmImport, wasmBinary] = await Promise.all([\n\t\timport('${s}' + 'navmesh.js'),\n\t\tfetch('${s}' + 'navmesh.wasm').then((res) => res.arrayBuffer()),\n\t]);\n\tconst wasmModule = wasmImport.default;\n\tself.module = await wasmModule({ wasmBinary });\n\tpostMessage('ready');\n})();\n`):"\n(async function() {\n\tconst [wasmImport, wasmBinary] = await Promise.all([\n\t\timport(self.location.origin + '/_libraries/navmesh.js'),\n\t\tfetch(self.location.origin + '/_libraries/navmesh.wasm').then((res) => res.arrayBuffer()),\n\t]);\n\tconst wasmModule = wasmImport.default;\n\tself.module = await wasmModule({ wasmBinary });\n\tpostMessage('ready');\n})();\n")+"\n\nonmessage = function(messageEvent) {\n\tconst meshData = messageEvent.data;\n\tconst positions = meshData[0];\n\tconst offset = meshData[1];\n\tconst indices = meshData[2];\n\tconst indicesLength = meshData[3];\n\tconst parameters = meshData[4];\n\n\tconst module = self.module;\n\tconst rc = new module.rcConfig();\n\trc.cs = parameters.cs;\n\trc.ch = parameters.ch;\n\trc.borderSize = parameters.borderSize ? parameters.borderSize : 0;\n\trc.tileSize = parameters.tileSize ? parameters.tileSize : 0;\n\trc.walkableSlopeAngle = parameters.walkableSlopeAngle;\n\trc.walkableHeight = parameters.walkableHeight;\n\trc.walkableClimb = parameters.walkableClimb;\n\trc.walkableRadius = parameters.walkableRadius;\n\trc.maxEdgeLen = parameters.maxEdgeLen;\n\trc.maxSimplificationError = parameters.maxSimplificationError;\n\trc.minRegionArea = parameters.minRegionArea;\n\trc.mergeRegionArea = parameters.mergeRegionArea;\n\trc.maxVertsPerPoly = parameters.maxVertsPerPoly;\n\trc.detailSampleDist = parameters.detailSampleDist;\n\trc.detailSampleMaxError = parameters.detailSampleMaxError;\n\n\tif (!self.navMesh) {\n\t\tself.navMesh = new module.NavMesh();\n\t}\n\tself.navMesh.build(positions, offset, indices, indicesLength, rc);\n\n\tconst navmeshData = navMesh.getNavmeshData();\n\tconst arrView = new Uint8Array(module.HEAPU8.buffer, navmeshData.dataPointer, navmeshData.size);\n\tconst ret = new Uint8Array(navmeshData.size);\n\tret.set(arrView);\n\tnavMesh.freeNavmeshData(navmeshData);\n\n\tpostMessage(ret);\n}\n"])),this._worker=new Worker(this._workerURL),this.whenWorkerReady=new Promise(t=>{this._worker.addEventListener("message",()=>t(),{once:!0})})}init(t,e,i){this.gameControl=e,this.eventContext=i,this.setDefaultQueryExtent((new F).setScalar(t.ch*t.walkableRadius*1.2)),this._worker.onmessage=()=>{this.createNavMesh(i.page,t,t=>{this.buildFromNavmeshData(t.data)})},this.eventContext.renderer.domElement.addEventListener("pointerdown",this.onPointerDown)}createNavMesh(t,e,i){e.objects.forEach(e=>{let i=t.scene.find(e);i.traverseEntity(t=>{t.userData.navmesh=!0}),i.cloner?.traverseObject(t=>{t.userData.navmesh=!0})});let o=[],s=(this.usePhysics?this.traverseWithPhysics:this.traverseNoPhysics)(o,"custom"===e.zones);if(t.traverseChildren(s),e.objects.forEach(e=>{let i=t.scene.find(e);i.traverseEntity(t=>{t.userData.navmesh=void 0}),i.cloner?.traverseObject(t=>{t.userData.navmesh=void 0})}),0===o.length)return!1;let r=g(o),{positions:n,triIndices:a}=u(r.getAttribute("position"),r.getIndex());return this._worker.postMessage([n,n.length/3,a,a.length,{...Jt,...e}]),this._worker.onmessage=i,!0}createDebugNavGeometry(){let t,e,i=this.navMesh.getDebugNavMesh(),o=i.getTriangleCount(),s=new Uint32Array(3*o),r=new Float32Array(3*o*3);for(t=0;t<3*o;t++)s[t]=t;for(t=0;t<o;t++)for(e=0;e<3;e++){let o=i.getTriangle(t).getPoint(e);r[9*t+3*e+0]=o.x,r[9*t+3*e+1]=o.y,r[9*t+3*e+2]=o.z}let n=new V;return n.setIndex(new k(s,1)),n.setAttribute("position",new k(r,3)),n}getClosestPoint(t){return Ht.x=t.x,Ht.y=t.y,Ht.z=t.z,this.navMesh.getClosestPoint(Ht)}getClosestPointToRef(t,e){Ht.x=t.x,Ht.y=t.y,Ht.z=t.z;let i=this.navMesh.getClosestPoint(Ht);e.set(i.x,i.y,i.z)}getRandomPointAround(t,e){return Ht.x=t.x,Ht.y=t.y,Ht.z=t.z,this.navMesh.getRandomPointAround(Ht,e)}getRandomPointAroundToRef(t,e,i){Ht.x=t.x,Ht.y=t.y,Ht.z=t.z;let o=this.navMesh.getRandomPointAround(Ht,e);i.set(o.x,o.y,o.z)}moveAlong(t,e){return Ht.x=t.x,Ht.y=t.y,Ht.z=t.z,Kt.x=e.x,Kt.y=e.y,Kt.z=e.z,this.navMesh.moveAlong(Ht,Kt)}moveAlongToRef(t,e,i){return Ht.x=t.x,Ht.y=t.y,Ht.z=t.z,Kt.x=e.x,Kt.y=e.y,Kt.z=e.z,this.navMesh.moveAlong(Ht,Kt)}computePath(t,e){let i=this.getClosestPoint(e);if(Kt.x=i.x,Kt.y=i.y,Kt.z=i.z,Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)+Math.pow(e.z-i.z,2))>this.getDefaultQueryExtent().y)return[];this.getClosestPoint(t);let o=this.navMesh.computePath(Ht,Kt),s=o.getPointCount(),r=[];for(let t=0;t<s;t++){let e=o.getPoint(t);r.push(new F(e.x,e.y,e.z))}return r}createCrowd(t,e){return new ee(this,t,e)}setDefaultQueryExtent(t){Ht.x=t.x,Ht.y=t.y,Ht.z=t.z,this.navMesh.setDefaultQueryExtent(Ht)}getDefaultQueryExtent(){return this.navMesh.getDefaultQueryExtent()}buildFromNavmeshData(t){let e=t.length*t.BYTES_PER_ELEMENT,i=this.navmeshWasm._malloc(e),o=new Uint8Array(this.navmeshWasm.HEAPU8.buffer,i,e);o.set(t);let s=new this.navmeshWasm.NavmeshData;s.dataPointer=o.byteOffset,s.size=t.length,this.navMesh.buildFromNavmeshData(s),this.navmeshWasm._free(o.byteOffset)}getNavmeshData(){let t=this.navMesh.getNavmeshData(),e=new Uint8Array(this.navmeshWasm.HEAPU8.buffer,t.dataPointer,t.size),i=new Uint8Array(t.size);return i.set(e),this.navMesh.freeNavmeshData(t),i}getDefaultQueryExtentToRef(t){let e=this.navMesh.getDefaultQueryExtent();t.set(e.x,e.y,e.z)}dispose(){this.navMesh.destroy(),this._worker.terminate(),URL.revokeObjectURL(this._workerURL),this.eventContext?.renderer.domElement.removeEventListener("pointerdown",this.onPointerDown)}addCylinderObstacle(t,e,i){return Ht.x=t.x,Ht.y=t.y,Ht.z=t.z,this.navMesh.addCylinderObstacle(Ht,e,i)}addBoxObstacle(t,e,i){return Ht.x=t.x,Ht.y=t.y,Ht.z=t.z,Kt.x=e.x,Kt.y=e.y,Kt.z=e.z,this.navMesh.addBoxObstacle(Ht,Kt,i)}removeObstacle(t){this.navMesh.removeObstacle(t)}isSupported(){return void 0!==this.navmeshWasm}},ee=class{constructor(t,e,i){this.navmeshWasmWrapper=t,this.transforms=[],this.agents=new Array,this.reachRadii=new Array,this._agentDestinationArmed=new Array,this._agentDestination=new Array,this.crowd=new this.navmeshWasmWrapper.navmeshWasm.Crowd(e,i,this.navmeshWasmWrapper.navMesh.getNavMesh())}onReachTarget(t,e){}addAgent(t,e,i){let o=new this.navmeshWasmWrapper.navmeshWasm.dtCrowdAgentParams;o.radius=e.radius,o.height=e.height,o.maxAcceleration=e.maxAcceleration,o.maxSpeed=e.maxSpeed,o.collisionQueryRange=e.collisionQueryRange,o.pathOptimizationRange=e.pathOptimizationRange,o.separationWeight=e.separationWeight,o.updateFlags=7,o.obstacleAvoidanceType=0,o.queryFilterType=0,o.userData=0;let s=this.crowd.addAgent(new this.navmeshWasmWrapper.navmeshWasm.Vec3(t.x,t.y,t.z),o);return this.transforms.push(i),this.agents.push(s),this.reachRadii.push(e.reachRadius?e.reachRadius:e.radius),this._agentDestinationArmed.push(!1),this._agentDestination.push(new F(0,0,0)),s}getAgentPosition(t){return this.crowd.getAgentPosition(t)}getAgentPositionToRef(t,e){let i=this.crowd.getAgentPosition(t);e.set(i.x,i.y,i.z)}getAgentVelocity(t){return this.crowd.getAgentVelocity(t)}getAgentVelocityToRef(t,e){let i=this.crowd.getAgentVelocity(t);e.set(i.x,i.y,i.z)}getAgentNextTargetPath(t){return this.crowd.getAgentNextTargetPath(t)}getAgentNextTargetPathToRef(t,e){let i=this.crowd.getAgentNextTargetPath(t);e.set(i.x,i.y,i.z)}getAgentState(t){return this.crowd.getAgentState(t)}overOffmeshConnection(t){return this.crowd.overOffmeshConnection(t)}agentGoto(t,e){this.crowd.agentGoto(t,new this.navmeshWasmWrapper.navmeshWasm.Vec3(e.x,e.y,e.z));let i=this.agents.indexOf(t);i>-1&&(this._agentDestinationArmed[i]=!0,this._agentDestination[i].set(e.x,e.y,e.z))}agentTeleport(t,e){this.crowd.agentTeleport(t,new this.navmeshWasmWrapper.navmeshWasm.Vec3(e.x,e.y,e.z))}updateAgentParameters(t,e){let i=this.crowd.getAgentParameters(t);void 0!==e.radius&&(i.radius=e.radius),void 0!==e.height&&(i.height=e.height),void 0!==e.maxAcceleration&&(i.maxAcceleration=e.maxAcceleration),void 0!==e.maxSpeed&&(i.maxSpeed=e.maxSpeed),void 0!==e.collisionQueryRange&&(i.collisionQueryRange=e.collisionQueryRange),void 0!==e.pathOptimizationRange&&(i.pathOptimizationRange=e.pathOptimizationRange),void 0!==e.separationWeight&&(i.separationWeight=e.separationWeight),this.crowd.setAgentParameters(t,i)}removeAgent(t){this.crowd.removeAgent(t);let e=this.agents.indexOf(t);e>-1&&(this.agents.splice(e,1),this.transforms.splice(e,1),this.reachRadii.splice(e,1),this._agentDestinationArmed.splice(e,1),this._agentDestination.splice(e,1))}getAgents(){return this.agents}update(t){if(this.navmeshWasmWrapper.navMesh.update(),t<=.001)return;let e=1/60;{let i=Math.floor(t/e);i>10&&(i=10),i<1&&(i=1);let o=t/i;for(let t=0;t<i;t++)this.crowd.update(o)}for(let t=0;t<this.agents.length;t++){let e=this.agents[t],i=this.getAgentPosition(e);if(this.transforms[t].copy(i),this._agentDestinationArmed[t]){let o=i.x-this._agentDestination[t].x,s=i.z-this._agentDestination[t].z,r=this.reachRadii[t],n=this._agentDestination[t].y-this.reachRadii[t],a=this._agentDestination[t].y+this.reachRadii[t],h=o*o+s*s;i.y>n&&i.y<a&&h<r*r&&(this.onReachTarget(e,this._agentDestination[t]),this._agentDestinationArmed[t]=!1)}}}setDefaultQueryExtent(t){let e=new this.navmeshWasmWrapper.navmeshWasm.Vec3(t.x,t.y,t.z);this.crowd.setDefaultQueryExtent(e)}getDefaultQueryExtent(){return this.crowd.getDefaultQueryExtent()}getDefaultQueryExtentToRef(t){let e=this.crowd.getDefaultQueryExtent();t.set(e.x,e.y,e.z)}getCorners(t){let e,i=this.crowd.getCorners(t),o=i.getPointCount(),s=[];for(e=0;e<o;e++){let t=i.getPoint(e);s.push(new F(t.x,t.y,t.z))}return s}dispose(){this.crowd.destroy()}};i({setup:function(t){let{manager:e,camera:i}=t,o=!1,s=5,r=8,n=9,a="drag",h=e.page.data.publish.gameControlObject,c=null!==h?e.page.find(h):null,d=null;if(c)for(let t of c.data.events){if(t.data.disabled||"GameControl"!==t.data.type)continue;let i=c;for(;e.usePhysics&&null!==(i=i.parent)?.parent;)i.data.physics;t.data.collisionEnabled&&(e.needsCollisionDetection=!0),null===d&&(d=t.data)}if(c&&d&&(!0===c.data.visible||!0===c.data.physics.enabled)){o=o||d.camera===i.uuid||c.uuid===i.uuid;let h=new qt(c,t.renderer.domElement,d,t.eventContext.page.data.globalPhysics,e,c.uuid!==i.uuid&&d.camera===i.uuid,i,e.page,t.sharedAssets);e.gameControl=h,s=d.joystickPosLoc,r=d.joystickRotLoc,n=d.jumpTouchButtonLoc,a=d.rotByTouch,l&&d.touchControl&&(e.joystickToGameControls[s]="pos","walk"===d.moveMode&&(e.joystickToGameControls[n]="jmp"),"joystick"===a&&(e.joystickToGameControls[r]="rot"))}if(e.gameControl&&e.gameControl.data.navmesh.enabled){let i=e.gameControl.data;if(!e.navigationMeshWrapper){let o;e.navigationMeshWrapper=new te(e.usePhysics,t.isExport),o="sphere"===i.collider.type?2*i.collider.radius:i.collider.height,o=Math.floor(o/i.navmesh.ch-1),e.navigationMeshWrapper.init({...i.navmesh,walkableHeight:o},e.gameControl,t.eventContext)}}return o},createJoysticks:function(t,e,i){t.joystickToGameControls.forEach((o,s)=>{let r=document.body.appendChild(document.createElement("div")),[n,a,h]=t.eventManager.eventContext.publish.joystickSizeAndXYOffset[s],l=(e-5*n)/4+n,c={},d="jmp"===o,m=d?0:n;s<10?(s<5?c.top=m/2:c.bottom=m/2,c.left=m/2+s%5*l):10===s?(c.left=m/2,c.top=i/2):(c.right=m/2,c.top=i/2),c.top?c.top-=a[1]:c.bottom+=a[1],c.left?c.left+=a[0]:c.right-=a[0];for(let t in c)c[t]+="px";if(d){let e=r.appendChild(document.createElement("div"));Object.assign(e.style,c,{position:"absolute",width:n+"px",height:n+"px",backgroundColor:`rgba(255,255,255,${"show"===h?.4:0})`,zIndex:"9999",borderRadius:n+"px",border:"show"===h?"solid 2px rgba(0, 0, 0, .1)":"none",display:"flex",alignItems:"center",justifyContent:"center",touchAction:"none"});let i=n/16*16*.4;return"show"===h&&(e.innerHTML=`\n\t\t\t\t\t\t<svg width="${i}" height="${.4*n}" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t\t\t<path d="M2 10L8 4L14 10" stroke="black" stroke-opacity="40%" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t`),e.addEventListener("pointerdown",()=>{t.gameControl.movementState.jump=1,t.requestRender()}),e.addEventListener("touchend",t=>t.preventDefault()),void(t.joysticks[s]=[void 0,r])}let p={zone:r,mode:"static",position:c,size:n};"hide"===h&&(p.restOpacity=0);let u=gt.create(p);u.on("move",(e,i)=>{let s=t.gameControl;"pos"===o?i.force<.2?s.moveForce=0:(s.movementState.movePosZ=Math.sin(-i.angle.radian),s.movementState.movePosX=Math.cos(-i.angle.radian),i.force>1.2?s.movementState.run=1:s.movementState.run=0,i.force<.3?s.moveForce=(i.force-.2)/.1:s.moveForce=1):"rot"===o&&(i.force<.2?s.rotForce=0:(s.movementState.rotPosX=i.vector.y,s.movementState.rotPosY=-i.vector.x,i.force<.3?s.rotForce=(i.force-.2)/.1:s.rotForce=1)),t.requestRender()}),u.on("end",(e,i)=>{let s=t.gameControl;"pos"===o?(s.movementState.movePosZ=0,s.movementState.movePosX=0,s.moveForce=1):"rot"===o&&(s.movementState.rotPosX=0,s.movementState.rotPosY=0,s.rotForce=1)}),t.joysticks[s]=[u,r]})}}),M("game-controls");
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{k as r}from"./runtime-chunk-KQTC7OLV.js";import"./runtime-chunk-WYIK4MJQ.js";import"./runtime-chunk-RTLL6WIB.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-BFGZJ4LR.js";import{a as i,d as m}from"./runtime-chunk-TZCHGFVF.js";import"./runtime-chunk-F6XTFQMZ.js";import"./runtime-chunk-KPOUV3HD.js";import"./runtime-chunk-ML3Z74BL.js";m("Hair",(i,m,n)=>new r(i,m,n)),i("hair");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
���tc=7U��np^l�|�A�RKNC[��&��y��y��>H�%�q����Y�O��y�=�oS?n\`\ק|��;��eS��9\���˖��;��R,��I;�%B�8�sV�~�^�A[����$�c8�w�m3�4
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t}from"./runtime-chunk-
|
|
1
|
+
import{a as t}from"./runtime-chunk-HGPSGN65.js";import"./runtime-chunk-JTXN6DIH.js";import{a as n}from"./runtime-chunk-UIRA2CWJ.js";import"./runtime-chunk-IBVB6UVI.js";import{Db as e,Dc as r,Hc as a,Ne as o,Qc as i,Vc as c,Xc as s,ye as y}from"./runtime-chunk-KPOUV3HD.js";import"./runtime-chunk-ML3Z74BL.js";new y,new c,new Float32Array([255/256/256**3,255/256/65536,255/256/256,255/256]);var l=new Map([[0,null],[1,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x+y,1.0)*opacity+x*(1.0-opacity);}"],[2,"vec3 blend(const in vec3 x,const in vec3 y,const in float opacity){return y*opacity+x*(1.0-opacity);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){float a=min(y.a,opacity);return vec4(blend(x.rgb,y.rgb,a),max(x.a,a));}"],[3,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y)*0.5*opacity+x*(1.0-opacity);}"],[4,"float blend(const in float x,const in float y){return(y==0.0)?y:max(1.0-(1.0-x)/y,0.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[5,"float blend(const in float x,const in float y){return(y==1.0)?y:min(x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[6,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x,y)*opacity+x*(1.0-opacity);}"],[7,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return abs(x-y)*opacity+x*(1.0-opacity);}"],[8,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y-2.0*x*y)*opacity+x*(1.0-opacity);}"],[9,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x,y)*opacity+x*(1.0-opacity);}"],[10,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return x*y*opacity+x*(1.0-opacity);}"],[11,"float blend(const in float x,const in float y){return(y>0.0)?min(x/y,1.0):1.0;}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[12,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-abs(1.0-x-y))*opacity+x*(1.0-opacity);}"],[13,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y*opacity+x*(1.0-opacity);}"],[14,"float blend(const in float x,const in float y){return(x<0.5)?(2.0*x*y):(1.0-2.0*(1.0-x)*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[15,"float blend(const in float x,const in float y){return(y==1.0)?y:min(x*x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[16,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-(1.0-x)*(1.0-y))*opacity+x*(1.0-opacity);}"],[17,"float blend(const in float x,const in float y){return(y<0.5)?(2.0*x*y+x*x*(1.0-2.0*y)):(sqrt(x)*(2.0*y-1.0)+2.0*x*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[18,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x+y-1.0,0.0)*opacity+x*(1.0-opacity);}"]]),u=class extends r{constructor(t,n=1){super(),this.f=t,this.opacity=new o(n)}getOpacity(){return this.opacity.value}setOpacity(t){this.opacity.value=t}get blendFunction(){return this.f}set blendFunction(t){this.f=t,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(t){this.blendFunction=t}getShaderCode(){return l.get(this.blendFunction)}},x=class extends r{constructor(t,n,{attributes:e=0,blendFunction:r=16,defines:a=new Map,uniforms:o=new Map,extensions:i=null,vertexShader:c=null}={}){super(),this.name=t,this.renderer=null,this.attributes=e,this.fragmentShader=n,this.vertexShader=c,this.defines=a,this.uniforms=o,this.extensions=i,this.blendMode=new u(r),this.blendMode.addEventListener("change",t=>this.setChanged())}getName(){return this.name}setRenderer(t){this.renderer=t}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(t){this.attributes=t,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(t){this.fragmentShader=t,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(t){this.vertexShader=t,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(t,n=e){}update(t,n,e){}setSize(t,n){}initialize(t,n,e){}dispose(){for(let t of Object.keys(this)){let n=this[t];if(null!==n&&"object"==typeof n&&"function"==typeof n.dispose){if(n instanceof s||n===this.renderer)continue;this[t].dispose()}}}},d=(new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10]),new a,new i,class extends x{constructor({blendFunction:t=13,hue:n=0,saturation:e=0}={}){super("HueSaturationEffect","uniform vec3 hue;uniform float saturation;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=vec3(dot(inputColor.rgb,hue.xyz),dot(inputColor.rgb,hue.zxy),dot(inputColor.rgb,hue.yzx));float average=(color.r+color.g+color.b)/3.0;vec3 diff=average-color;if(saturation>0.0){color+=diff*(1.0-1.0/(1.001-saturation));}else{color+=diff*-saturation;}outputColor=vec4(min(color,1.0),inputColor.a);}",{blendFunction:t,uniforms:new Map([["hue",new o(new a)],["saturation",new o(e)]])}),this.hue=n}get saturation(){return this.uniforms.get("saturation").value}set saturation(t){this.uniforms.get("saturation").value=t}getSaturation(){return this.saturation}setSaturation(t){this.saturation=t}get hue(){let t=this.uniforms.get("hue").value;return Math.acos((3*t.x-1)/2)}set hue(t){let n=Math.sin(t),e=Math.cos(t);this.uniforms.get("hue").value.set((2*e+1)/3,(-Math.sqrt(3)*n-e+1)/3,(Math.sqrt(3)*n-e+1)/3)}getHue(){return this.hue}setHue(t){this.hue=t}});function w(t,n,e){return t+(n-t)*e}function h(t,n,e,r){let a=w(t,n,.75),o=w(e,r,.75);return w(a,o,.875)}new c,Math.PI,new a,new a,new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array(2),new Float32Array(2),new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125]),new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4]),new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3]),new Map([[h(0,0,0,0),new Float32Array([0,0,0,0])],[h(0,0,0,1),new Float32Array([0,0,0,1])],[h(0,0,1,0),new Float32Array([0,0,1,0])],[h(0,0,1,1),new Float32Array([0,0,1,1])],[h(0,1,0,0),new Float32Array([0,1,0,0])],[h(0,1,0,1),new Float32Array([0,1,0,1])],[h(0,1,1,0),new Float32Array([0,1,1,0])],[h(0,1,1,1),new Float32Array([0,1,1,1])],[h(1,0,0,0),new Float32Array([1,0,0,0])],[h(1,0,0,1),new Float32Array([1,0,0,1])],[h(1,0,1,0),new Float32Array([1,0,1,0])],[h(1,0,1,1),new Float32Array([1,0,1,1])],[h(1,1,0,0),new Float32Array([1,1,0,0])],[h(1,1,0,1),new Float32Array([1,1,0,1])],[h(1,1,1,0),new Float32Array([1,1,1,0])],[h(1,1,1,1),new Float32Array([1,1,1,1])]]);var v=class extends t{constructor(){super(d),this._hue=0}set hue(t){this._hue=t,this.effect.setHue(t)}get hue(){return this._hue}set saturation(t){this.effect.uniforms.get("saturation").value=t}get saturation(){return this.effect.uniforms.get("saturation").value}};n("hueSaturation",()=>new v);
|
|
Binary file
|
|
Binary file
|