@splinetool/runtime 2.0.4 → 2.0.6
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/opentype.js +1 -1
- package/build/opentype.js.br +0 -0
- package/build/opentype.js.gz +0 -0
- package/build/{runtime-aiAssistant-RMA2DMFU.js → runtime-aiAssistant-KA7ZJ3F6.js} +1 -1
- package/build/runtime-aiAssistant-KA7ZJ3F6.js.br +0 -0
- package/build/runtime-aiAssistant-KA7ZJ3F6.js.gz +0 -0
- package/build/{runtime-apiServices-KA4FEP5Y.js → runtime-apiServices-CGMAW2B4.js} +1 -1
- package/build/runtime-apiServices-CGMAW2B4.js.br +0 -0
- package/build/runtime-apiServices-CGMAW2B4.js.gz +0 -0
- package/build/{runtime-audio-BQSRM3W2.js → runtime-audio-GCUGVRQ3.js} +1 -1
- package/build/runtime-audio-GCUGVRQ3.js.br +0 -0
- package/build/runtime-audio-GCUGVRQ3.js.gz +0 -0
- package/build/{runtime-chunk-R7NC6CZZ.js → runtime-chunk-3KIZF7P5.js} +1 -1
- package/build/runtime-chunk-3KIZF7P5.js.br +0 -0
- package/build/runtime-chunk-3KIZF7P5.js.gz +0 -0
- package/build/{runtime-chunk-TPKGBIJU.js → runtime-chunk-4DNX5FPP.js} +1 -1
- package/build/runtime-chunk-4DNX5FPP.js.br +0 -0
- package/build/runtime-chunk-4DNX5FPP.js.gz +0 -0
- package/build/{runtime-chunk-I5QFGBIU.js → runtime-chunk-4E4NQ6GS.js} +1 -1
- package/build/runtime-chunk-4E4NQ6GS.js.br +0 -0
- package/build/runtime-chunk-4E4NQ6GS.js.gz +0 -0
- package/build/{runtime-chunk-OOC7YSI5.js → runtime-chunk-4KX4KQWR.js} +1 -1
- package/build/runtime-chunk-4KX4KQWR.js.br +0 -0
- package/build/runtime-chunk-4KX4KQWR.js.gz +0 -0
- package/build/{runtime-chunk-MBBODDV7.js → runtime-chunk-5H2Z5KYI.js} +1 -1
- package/build/runtime-chunk-5H2Z5KYI.js.br +0 -0
- package/build/{runtime-chunk-MBBODDV7.js.gz → runtime-chunk-5H2Z5KYI.js.gz} +0 -0
- package/build/{runtime-chunk-RF63UVAU.js → runtime-chunk-AKWBEROQ.js} +1 -1
- package/build/runtime-chunk-AKWBEROQ.js.br +0 -0
- package/build/runtime-chunk-AKWBEROQ.js.gz +0 -0
- package/build/{runtime-chunk-4I22JDL6.js → runtime-chunk-BPYFB4BD.js} +1 -1
- package/build/runtime-chunk-BPYFB4BD.js.br +0 -0
- package/build/runtime-chunk-BPYFB4BD.js.gz +0 -0
- package/build/runtime-chunk-CCJD7IX7.js +1 -0
- package/build/runtime-chunk-CCJD7IX7.js.br +0 -0
- package/build/runtime-chunk-CCJD7IX7.js.gz +0 -0
- package/build/{runtime-chunk-W4ZCHGLQ.js → runtime-chunk-CEAWQBAS.js} +1 -1
- package/build/runtime-chunk-CEAWQBAS.js.br +0 -0
- package/build/runtime-chunk-CEAWQBAS.js.gz +0 -0
- package/build/{runtime-chunk-ZMXEX5NX.js → runtime-chunk-CX2MRLZA.js} +1 -1
- package/build/runtime-chunk-CX2MRLZA.js.br +0 -0
- package/build/runtime-chunk-CX2MRLZA.js.gz +0 -0
- package/build/{runtime-chunk-WHKBOV2O.js → runtime-chunk-FY3XD5P2.js} +1 -1
- package/build/runtime-chunk-FY3XD5P2.js.br +0 -0
- package/build/runtime-chunk-FY3XD5P2.js.gz +0 -0
- package/build/{runtime-chunk-DSJY3WL2.js → runtime-chunk-GN3HDYV2.js} +1 -1
- package/build/runtime-chunk-GN3HDYV2.js.br +0 -0
- package/build/runtime-chunk-GN3HDYV2.js.gz +0 -0
- package/build/{runtime-chunk-LT4UVXE2.js → runtime-chunk-GO25U5WN.js} +1 -1
- package/build/runtime-chunk-GO25U5WN.js.br +0 -0
- package/build/runtime-chunk-GO25U5WN.js.gz +0 -0
- package/build/{runtime-chunk-ESZD4IRS.js → runtime-chunk-H7D3VFTJ.js} +1 -1
- package/build/runtime-chunk-H7D3VFTJ.js.br +0 -0
- package/build/runtime-chunk-H7D3VFTJ.js.gz +0 -0
- package/build/runtime-chunk-HUFJRFTO.js +1 -0
- package/build/runtime-chunk-HUFJRFTO.js.br +0 -0
- package/build/runtime-chunk-HUFJRFTO.js.gz +0 -0
- package/build/{runtime-chunk-SL64ZYCB.js → runtime-chunk-ITLS6YIC.js} +1 -1
- package/build/runtime-chunk-ITLS6YIC.js.br +0 -0
- package/build/runtime-chunk-ITLS6YIC.js.gz +0 -0
- package/build/{runtime-chunk-V5NUL7BL.js → runtime-chunk-JQ3A6ENO.js} +1 -1
- package/build/runtime-chunk-JQ3A6ENO.js.br +1 -0
- package/build/runtime-chunk-JQ3A6ENO.js.gz +0 -0
- package/build/{runtime-chunk-36FZTFCC.js → runtime-chunk-KYA2CB5O.js} +1 -1
- package/build/runtime-chunk-KYA2CB5O.js.br +0 -0
- package/build/runtime-chunk-KYA2CB5O.js.gz +0 -0
- package/build/{runtime-chunk-NTW4X3NC.js → runtime-chunk-LX3KCQF6.js} +1 -1
- package/build/runtime-chunk-LX3KCQF6.js.br +0 -0
- package/build/runtime-chunk-LX3KCQF6.js.gz +0 -0
- package/build/{runtime-chunk-USXMESRF.js → runtime-chunk-M3ZKF7PK.js} +1 -1
- package/build/runtime-chunk-M3ZKF7PK.js.br +0 -0
- package/build/runtime-chunk-M3ZKF7PK.js.gz +0 -0
- package/build/{runtime-chunk-GPACKOH2.js → runtime-chunk-MM2G3DLE.js} +1 -1
- package/build/runtime-chunk-MM2G3DLE.js.br +0 -0
- package/build/runtime-chunk-MM2G3DLE.js.gz +0 -0
- package/build/runtime-chunk-NAJSQF6K.js +1 -0
- package/build/runtime-chunk-NAJSQF6K.js.br +0 -0
- package/build/runtime-chunk-NAJSQF6K.js.gz +0 -0
- package/build/{runtime-chunk-QVC5UDJO.js → runtime-chunk-NWCLOXDY.js} +1 -1
- package/build/runtime-chunk-NWCLOXDY.js.br +0 -0
- package/build/runtime-chunk-NWCLOXDY.js.gz +0 -0
- package/build/{runtime-chunk-V7XDOE2W.js → runtime-chunk-OF7IZ6BI.js} +1 -1
- package/build/runtime-chunk-OF7IZ6BI.js.br +0 -0
- package/build/runtime-chunk-OF7IZ6BI.js.gz +0 -0
- package/build/{runtime-chunk-ZJPGZKPX.js → runtime-chunk-PUBEJSJO.js} +1 -1
- package/build/runtime-chunk-PUBEJSJO.js.br +0 -0
- package/build/runtime-chunk-PUBEJSJO.js.gz +0 -0
- package/build/{runtime-chunk-5XUI4Z6R.js → runtime-chunk-R34HNX2O.js} +1 -1
- package/build/runtime-chunk-R34HNX2O.js.br +0 -0
- package/build/runtime-chunk-R34HNX2O.js.gz +0 -0
- package/build/runtime-chunk-RBM3UDQF.js +1 -0
- package/build/runtime-chunk-RBM3UDQF.js.br +0 -0
- package/build/runtime-chunk-RBM3UDQF.js.gz +0 -0
- package/build/{runtime-chunk-CIBY4YG3.js → runtime-chunk-RRXSRYPQ.js} +1 -1
- package/build/runtime-chunk-RRXSRYPQ.js.br +0 -0
- package/build/runtime-chunk-RRXSRYPQ.js.gz +0 -0
- package/build/{runtime-chunk-YFAATRJU.js → runtime-chunk-SXPM42HJ.js} +1 -1
- package/build/runtime-chunk-SXPM42HJ.js.br +0 -0
- package/build/runtime-chunk-SXPM42HJ.js.gz +0 -0
- package/build/{runtime-chunk-WMWQXAOH.js → runtime-chunk-XUM5HEC6.js} +1 -1
- package/build/runtime-chunk-XUM5HEC6.js.br +0 -0
- package/build/runtime-chunk-XUM5HEC6.js.gz +0 -0
- package/build/{runtime-chunk-3J5YHSQW.js → runtime-chunk-XXRCB3ME.js} +1 -1
- package/build/runtime-chunk-XXRCB3ME.js.br +0 -0
- package/build/runtime-chunk-XXRCB3ME.js.gz +0 -0
- package/build/{runtime-classicRuntime-UOZ6RID5.js → runtime-classicRuntime-PJ7JLKSY.js} +1 -1
- package/build/runtime-classicRuntime-PJ7JLKSY.js.br +0 -0
- package/build/runtime-classicRuntime-PJ7JLKSY.js.gz +0 -0
- package/build/runtime-cloners-SM2IKR3Q.js +1 -0
- package/build/runtime-cloners-SM2IKR3Q.js.br +3 -0
- package/build/runtime-cloners-SM2IKR3Q.js.gz +0 -0
- package/build/{runtime-components-IGNRKI6T.js → runtime-components-VRLLFORJ.js} +1 -1
- package/build/runtime-components-VRLLFORJ.js.br +0 -0
- package/build/runtime-components-VRLLFORJ.js.gz +0 -0
- package/build/{runtime-conditional-DCOFCW5I.js → runtime-conditional-VA7AKA6O.js} +1 -1
- package/build/runtime-conditional-VA7AKA6O.js.br +0 -0
- package/build/runtime-conditional-VA7AKA6O.js.gz +0 -0
- package/build/{runtime-createDestroy-JLB7IIQL.js → runtime-createDestroy-IQVBLQ24.js} +1 -1
- package/build/runtime-createDestroy-IQVBLQ24.js.br +0 -0
- package/build/runtime-createDestroy-IQVBLQ24.js.gz +0 -0
- package/build/{runtime-dragDrop-ERDSNA3S.js → runtime-dragDrop-XFI62H3C.js} +1 -1
- package/build/runtime-dragDrop-XFI62H3C.js.br +0 -0
- package/build/runtime-dragDrop-XFI62H3C.js.gz +0 -0
- package/build/{runtime-fxBloom-IGFV4KJD.js → runtime-fxBloom-KENIJKIM.js} +1 -1
- package/build/runtime-fxBloom-KENIJKIM.js.br +0 -0
- package/build/runtime-fxBloom-KENIJKIM.js.gz +0 -0
- package/build/runtime-fxDepthOfField-XNWQKT4G.js +1 -0
- package/build/runtime-fxDepthOfField-XNWQKT4G.js.br +0 -0
- package/build/runtime-fxDepthOfField-XNWQKT4G.js.gz +0 -0
- package/build/{runtime-gameControls-XKOQVZZC.js → runtime-gameControls-W3YS7OS2.js} +1 -1
- package/build/runtime-gameControls-W3YS7OS2.js.br +0 -0
- package/build/runtime-gameControls-W3YS7OS2.js.gz +0 -0
- package/build/runtime-hair-CWPDHNZF.js +1 -0
- package/build/runtime-hair-CWPDHNZF.js.br +1 -0
- package/build/runtime-hair-CWPDHNZF.js.gz +0 -0
- package/build/{runtime-mergeStaticGeometries-4Y3LE3VX.js → runtime-mergeStaticGeometries-KJFDZ7TP.js} +1 -1
- package/build/runtime-mergeStaticGeometries-KJFDZ7TP.js.br +0 -0
- package/build/runtime-mergeStaticGeometries-KJFDZ7TP.js.gz +0 -0
- package/build/{runtime-miscActions-KIRLTM7C.js → runtime-miscActions-UGVVC2QC.js} +1 -1
- package/build/runtime-miscActions-UGVVC2QC.js.br +0 -0
- package/build/runtime-miscActions-UGVVC2QC.js.gz +0 -0
- package/build/{runtime-mouseHover-WULIJFG2.js → runtime-mouseHover-O7Y26SM5.js} +1 -1
- package/build/runtime-mouseHover-O7Y26SM5.js.br +0 -0
- package/build/runtime-mouseHover-O7Y26SM5.js.gz +0 -0
- package/build/{runtime-particles-NNV35DLD.js → runtime-particles-GFRULQXO.js} +1 -1
- package/build/runtime-particles-GFRULQXO.js.br +0 -0
- package/build/runtime-particles-GFRULQXO.js.gz +0 -0
- package/build/{runtime-paths-RRXZ3PXM.js → runtime-paths-Q7I56BAX.js} +1 -1
- package/build/runtime-paths-Q7I56BAX.js.br +0 -0
- package/build/runtime-paths-Q7I56BAX.js.gz +0 -0
- package/build/{runtime-resize-V6LZSOZB.js → runtime-resize-2ZFLSK2M.js} +1 -1
- package/build/runtime-resize-2ZFLSK2M.js.br +0 -0
- package/build/runtime-resize-2ZFLSK2M.js.gz +0 -0
- package/build/{runtime-sceneTransition-CP5TI3VP.js → runtime-sceneTransition-Z65VROHI.js} +1 -1
- package/build/runtime-sceneTransition-Z65VROHI.js.br +0 -0
- package/build/runtime-sceneTransition-Z65VROHI.js.gz +0 -0
- package/build/{runtime-scroll-Q7VGS5NM.js → runtime-scroll-NWKW6A6L.js} +1 -1
- package/build/runtime-scroll-NWKW6A6L.js.br +0 -0
- package/build/runtime-scroll-NWKW6A6L.js.gz +0 -0
- package/build/runtime-shapeBlends-QB7JKEHC.js +1 -0
- package/build/runtime-shapeBlends-QB7JKEHC.js.br +5 -0
- package/build/runtime-shapeBlends-QB7JKEHC.js.gz +0 -0
- package/build/runtime-text-VK3OGBSY.js +1 -0
- package/build/runtime-text-VK3OGBSY.js.br +0 -0
- package/build/runtime-text-VK3OGBSY.js.gz +0 -0
- package/build/{runtime-textInputs-IW2E6BNU.js → runtime-textInputs-JJQSKO3C.js} +1 -1
- package/build/runtime-textInputs-JJQSKO3C.js.br +0 -0
- package/build/runtime-textInputs-JJQSKO3C.js.gz +0 -0
- package/build/{runtime-timeline-JA2JZIS7.js → runtime-timeline-WRAEBCRZ.js} +1 -1
- package/build/runtime-timeline-WRAEBCRZ.js.br +0 -0
- package/build/runtime-timeline-WRAEBCRZ.js.gz +0 -0
- package/build/{runtime-tracking-M57J2PGK.js → runtime-tracking-KYP5WOMH.js} +1 -1
- package/build/runtime-tracking-KYP5WOMH.js.br +0 -0
- package/build/runtime-tracking-KYP5WOMH.js.gz +0 -0
- package/build/{runtime-transitions-PELRDE7B.js → runtime-transitions-FDRKYMVP.js} +1 -1
- package/build/runtime-transitions-FDRKYMVP.js.br +0 -0
- package/build/runtime-transitions-FDRKYMVP.js.gz +0 -0
- package/build/runtime-ui2d-YO6M74VQ.js +1 -0
- package/build/runtime-ui2d-YO6M74VQ.js.br +0 -0
- package/build/runtime-ui2d-YO6M74VQ.js.gz +0 -0
- package/build/{runtime-updater-3ELP7WMM.js → runtime-updater-FS5YHXO4.js} +1 -1
- package/build/runtime-updater-FS5YHXO4.js.br +1 -0
- package/build/runtime-updater-FS5YHXO4.js.gz +0 -0
- package/build/{runtime-variables-Q6Q2JCGI.js → runtime-variables-CYDDC6HF.js} +1 -1
- package/build/runtime-variables-CYDDC6HF.js.br +0 -0
- package/build/runtime-variables-CYDDC6HF.js.gz +0 -0
- package/build/{runtime-vectorShapes-ISY7MWHY.js → runtime-vectorShapes-VMDJ36X2.js} +1 -1
- package/build/runtime-vectorShapes-VMDJ36X2.js.br +0 -0
- package/build/runtime-vectorShapes-VMDJ36X2.js.gz +0 -0
- package/build/{runtime-video-DUDXGADJ.js → runtime-video-MTXK33PT.js} +1 -1
- package/build/runtime-video-MTXK33PT.js.br +0 -0
- package/build/runtime-video-MTXK33PT.js.gz +0 -0
- package/build/runtime-webgpu-WDY6L7BV.js +1 -0
- package/build/runtime-webgpu-WDY6L7BV.js.br +0 -0
- package/build/runtime-webgpu-WDY6L7BV.js.gz +0 -0
- package/build/runtime.cjs +323 -323
- 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 +2 -1
- package/build/runtime-aiAssistant-RMA2DMFU.js.br +0 -0
- package/build/runtime-aiAssistant-RMA2DMFU.js.gz +0 -0
- package/build/runtime-apiServices-KA4FEP5Y.js.br +0 -0
- package/build/runtime-apiServices-KA4FEP5Y.js.gz +0 -0
- package/build/runtime-audio-BQSRM3W2.js.br +0 -0
- package/build/runtime-audio-BQSRM3W2.js.gz +0 -0
- package/build/runtime-chunk-36FZTFCC.js.br +0 -0
- package/build/runtime-chunk-36FZTFCC.js.gz +0 -0
- package/build/runtime-chunk-3J5YHSQW.js.br +0 -0
- package/build/runtime-chunk-3J5YHSQW.js.gz +0 -0
- package/build/runtime-chunk-4I22JDL6.js.br +0 -0
- package/build/runtime-chunk-4I22JDL6.js.gz +0 -0
- package/build/runtime-chunk-5XUI4Z6R.js.br +0 -0
- package/build/runtime-chunk-5XUI4Z6R.js.gz +0 -0
- package/build/runtime-chunk-6UUF5VIS.js +0 -1
- package/build/runtime-chunk-6UUF5VIS.js.br +0 -0
- package/build/runtime-chunk-6UUF5VIS.js.gz +0 -0
- package/build/runtime-chunk-CIBY4YG3.js.br +0 -0
- package/build/runtime-chunk-CIBY4YG3.js.gz +0 -0
- package/build/runtime-chunk-DKGQ6OYZ.js +0 -1
- package/build/runtime-chunk-DKGQ6OYZ.js.br +0 -0
- package/build/runtime-chunk-DKGQ6OYZ.js.gz +0 -0
- package/build/runtime-chunk-DSJY3WL2.js.br +0 -0
- package/build/runtime-chunk-DSJY3WL2.js.gz +0 -0
- package/build/runtime-chunk-ESZD4IRS.js.br +0 -0
- package/build/runtime-chunk-ESZD4IRS.js.gz +0 -0
- package/build/runtime-chunk-GPACKOH2.js.br +0 -0
- package/build/runtime-chunk-GPACKOH2.js.gz +0 -0
- package/build/runtime-chunk-I5QFGBIU.js.br +0 -0
- package/build/runtime-chunk-I5QFGBIU.js.gz +0 -0
- package/build/runtime-chunk-JNSHQPHC.js +0 -1
- package/build/runtime-chunk-JNSHQPHC.js.br +0 -0
- package/build/runtime-chunk-JNSHQPHC.js.gz +0 -0
- package/build/runtime-chunk-LT4UVXE2.js.br +0 -0
- package/build/runtime-chunk-LT4UVXE2.js.gz +0 -0
- package/build/runtime-chunk-MBBODDV7.js.br +0 -0
- package/build/runtime-chunk-NTW4X3NC.js.br +0 -0
- package/build/runtime-chunk-NTW4X3NC.js.gz +0 -0
- package/build/runtime-chunk-OOC7YSI5.js.br +0 -0
- package/build/runtime-chunk-OOC7YSI5.js.gz +0 -0
- package/build/runtime-chunk-OW6T4XFV.js +0 -1
- package/build/runtime-chunk-OW6T4XFV.js.br +0 -0
- package/build/runtime-chunk-OW6T4XFV.js.gz +0 -0
- package/build/runtime-chunk-QVC5UDJO.js.br +0 -0
- package/build/runtime-chunk-QVC5UDJO.js.gz +0 -0
- package/build/runtime-chunk-R7NC6CZZ.js.br +0 -0
- package/build/runtime-chunk-R7NC6CZZ.js.gz +0 -0
- package/build/runtime-chunk-RF63UVAU.js.br +0 -0
- package/build/runtime-chunk-RF63UVAU.js.gz +0 -0
- package/build/runtime-chunk-SL64ZYCB.js.br +0 -0
- package/build/runtime-chunk-SL64ZYCB.js.gz +0 -0
- package/build/runtime-chunk-TPKGBIJU.js.br +0 -0
- package/build/runtime-chunk-TPKGBIJU.js.gz +0 -0
- package/build/runtime-chunk-USXMESRF.js.br +0 -0
- package/build/runtime-chunk-USXMESRF.js.gz +0 -0
- package/build/runtime-chunk-V5NUL7BL.js.br +0 -1
- package/build/runtime-chunk-V5NUL7BL.js.gz +0 -0
- package/build/runtime-chunk-V7XDOE2W.js.br +0 -0
- package/build/runtime-chunk-V7XDOE2W.js.gz +0 -0
- package/build/runtime-chunk-W4ZCHGLQ.js.br +0 -0
- package/build/runtime-chunk-W4ZCHGLQ.js.gz +0 -0
- package/build/runtime-chunk-WHKBOV2O.js.br +0 -0
- package/build/runtime-chunk-WHKBOV2O.js.gz +0 -0
- package/build/runtime-chunk-WMWQXAOH.js.br +0 -0
- package/build/runtime-chunk-WMWQXAOH.js.gz +0 -0
- package/build/runtime-chunk-YFAATRJU.js.br +0 -0
- package/build/runtime-chunk-YFAATRJU.js.gz +0 -0
- package/build/runtime-chunk-ZJPGZKPX.js.br +0 -0
- package/build/runtime-chunk-ZJPGZKPX.js.gz +0 -0
- package/build/runtime-chunk-ZMXEX5NX.js.br +0 -0
- package/build/runtime-chunk-ZMXEX5NX.js.gz +0 -0
- package/build/runtime-classicRuntime-UOZ6RID5.js.br +0 -0
- package/build/runtime-classicRuntime-UOZ6RID5.js.gz +0 -0
- package/build/runtime-cloners-DALMNZYL.js +0 -1
- package/build/runtime-cloners-DALMNZYL.js.br +0 -0
- package/build/runtime-cloners-DALMNZYL.js.gz +0 -0
- package/build/runtime-components-IGNRKI6T.js.br +0 -0
- package/build/runtime-components-IGNRKI6T.js.gz +0 -0
- package/build/runtime-conditional-DCOFCW5I.js.br +0 -0
- package/build/runtime-conditional-DCOFCW5I.js.gz +0 -0
- package/build/runtime-createDestroy-JLB7IIQL.js.br +0 -0
- package/build/runtime-createDestroy-JLB7IIQL.js.gz +0 -0
- package/build/runtime-dragDrop-ERDSNA3S.js.br +0 -0
- package/build/runtime-dragDrop-ERDSNA3S.js.gz +0 -0
- package/build/runtime-fxBloom-IGFV4KJD.js.br +0 -0
- package/build/runtime-fxBloom-IGFV4KJD.js.gz +0 -0
- package/build/runtime-fxDepthOfField-WX7WD3K4.js +0 -1
- package/build/runtime-fxDepthOfField-WX7WD3K4.js.br +0 -0
- package/build/runtime-fxDepthOfField-WX7WD3K4.js.gz +0 -0
- package/build/runtime-gameControls-XKOQVZZC.js.br +0 -0
- package/build/runtime-gameControls-XKOQVZZC.js.gz +0 -0
- package/build/runtime-hair-EOZHA2BH.js +0 -1
- package/build/runtime-hair-EOZHA2BH.js.br +0 -0
- package/build/runtime-hair-EOZHA2BH.js.gz +0 -0
- package/build/runtime-mergeStaticGeometries-4Y3LE3VX.js.br +0 -0
- package/build/runtime-mergeStaticGeometries-4Y3LE3VX.js.gz +0 -0
- package/build/runtime-miscActions-KIRLTM7C.js.br +0 -0
- package/build/runtime-miscActions-KIRLTM7C.js.gz +0 -0
- package/build/runtime-mouseHover-WULIJFG2.js.br +0 -0
- package/build/runtime-mouseHover-WULIJFG2.js.gz +0 -0
- package/build/runtime-particles-NNV35DLD.js.br +0 -0
- package/build/runtime-particles-NNV35DLD.js.gz +0 -0
- package/build/runtime-paths-RRXZ3PXM.js.br +0 -0
- package/build/runtime-paths-RRXZ3PXM.js.gz +0 -0
- package/build/runtime-resize-V6LZSOZB.js.br +0 -0
- package/build/runtime-resize-V6LZSOZB.js.gz +0 -0
- package/build/runtime-sceneTransition-CP5TI3VP.js.br +0 -0
- package/build/runtime-sceneTransition-CP5TI3VP.js.gz +0 -0
- package/build/runtime-scroll-Q7VGS5NM.js.br +0 -0
- package/build/runtime-scroll-Q7VGS5NM.js.gz +0 -0
- package/build/runtime-shapeBlends-UN7GGFRG.js +0 -1
- package/build/runtime-shapeBlends-UN7GGFRG.js.br +0 -0
- package/build/runtime-shapeBlends-UN7GGFRG.js.gz +0 -0
- package/build/runtime-text-N6XLUSM2.js +0 -1
- package/build/runtime-text-N6XLUSM2.js.br +0 -0
- package/build/runtime-text-N6XLUSM2.js.gz +0 -0
- package/build/runtime-textInputs-IW2E6BNU.js.br +0 -0
- package/build/runtime-textInputs-IW2E6BNU.js.gz +0 -0
- package/build/runtime-timeline-JA2JZIS7.js.br +0 -0
- package/build/runtime-timeline-JA2JZIS7.js.gz +0 -0
- package/build/runtime-tracking-M57J2PGK.js.br +0 -0
- package/build/runtime-tracking-M57J2PGK.js.gz +0 -0
- package/build/runtime-transitions-PELRDE7B.js.br +0 -0
- package/build/runtime-transitions-PELRDE7B.js.gz +0 -0
- package/build/runtime-ui2d-IOB5Y76W.js +0 -1
- package/build/runtime-ui2d-IOB5Y76W.js.br +0 -0
- package/build/runtime-ui2d-IOB5Y76W.js.gz +0 -0
- package/build/runtime-updater-3ELP7WMM.js.br +0 -1
- package/build/runtime-updater-3ELP7WMM.js.gz +0 -0
- package/build/runtime-variables-Q6Q2JCGI.js.br +0 -0
- package/build/runtime-variables-Q6Q2JCGI.js.gz +0 -0
- package/build/runtime-vectorShapes-ISY7MWHY.js.br +0 -0
- package/build/runtime-vectorShapes-ISY7MWHY.js.gz +0 -0
- package/build/runtime-video-DUDXGADJ.js.br +0 -0
- package/build/runtime-video-DUDXGADJ.js.gz +0 -0
- package/build/runtime-webgpu-4ZCV5EAD.js +0 -1
- package/build/runtime-webgpu-4ZCV5EAD.js.br +0 -0
- package/build/runtime-webgpu-4ZCV5EAD.js.gz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t}from"./runtime-chunk-ZJPGZKPX.js";import"./runtime-chunk-CIBY4YG3.js";import{c as e,d as i,f as o,g as s,i as n,k as r,l as a}from"./runtime-chunk-R7NC6CZZ.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{a as m}from"./runtime-chunk-ESZD4IRS.js";import"./runtime-chunk-V5NUL7BL.js";import"./runtime-chunk-WMWQXAOH.js";import"./runtime-chunk-SL64ZYCB.js";import"./runtime-chunk-I5QFGBIU.js";import"./runtime-chunk-RF63UVAU.js";import{$ as p,G as u,N as y,a as g,p as f}from"./runtime-chunk-YFAATRJU.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{f as v,g as b}from"./runtime-chunk-QVC5UDJO.js";import{h as x}from"./runtime-chunk-OOC7YSI5.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-5XUI4Z6R.js";import{a as w}from"./runtime-chunk-TZCHGFVF.js";import{Ka as P,La as M,ea as E,g as S,ua as j}from"./runtime-chunk-OW6T4XFV.js";import{Bc as A,Cc as T,Dc as k,Ec as D,Fc as C,Oc as O,Pc as z,Re as R,Xc as F,Zc as _,dd as X,ld as W}from"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var N=(t,e)=>{let i=e.x-t.x,o=e.y-t.y;return Math.sqrt(i*i+o*o)},V=t=>t*(Math.PI/180),I=new Map,L=(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)},Q=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),Y=()=>{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}},B=(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")},G=(t,e,i)=>{let o=q(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},q=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},U=(t,e)=>{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},H=(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"&&(K="ontouchstart"in window,J=!!window.PointerEvent,$=!!window.MSPointerEvent);var K,J,$,tt,et={start:"mousedown",move:"mousemove",end:"mouseup"},it={};function ot(){}J?tt={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:$?tt={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:K?(tt={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},it=et):tt=et,ot.prototype.on=function(t,e){var i,o=this,s=t.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var n=0;n<s.length;n+=1)i=s[n],o._handlers_[i]=o._handlers_[i]||[],o._handlers_[i].push(e);return o},ot.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},ot.prototype.trigger=function(t,e){var i,o=this,s=t.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var n=0;n<s.length;n+=1)i=s[n],o._handlers_[i]&&o._handlers_[i].length&&o._handlers_[i].forEach(function(t){t.call(o,{type:i,target:o},e)})},ot.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))},ot.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.')},L(t,tt[e],i._domHandlers_[e]),it[e]&&L(t,it[e],i._domHandlers_[e]),i},ot.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},Z(t,tt[e],i._domHandlers_[e]),it[e]&&Z(t,it[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var st=ot;function nt(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=nt.id,nt.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}nt.prototype=new st,nt.constructor=nt,nt.id=0,nt.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},nt.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=(()=>{let t=q("borderRadius");for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e]="50%");return t})(),i=G("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)"},U(o.el,i),"circle"===this.options.shape&&U(o.back,e),U(o.front,e),this.applyStyles(o),this},nt.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},nt.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},nt.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},nt.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},nt.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},nt.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},nt.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=G("transition",["top","left"],o);var n={front:{}};n.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(s),i.applyStyles(n),i.restTimeout=setTimeout(function(){"function"==typeof t&&t.call(i),i.restCallback()},i.options.fadeTime)},nt.prototype.restCallback=function(){var t=this,e={};e.front=G("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},nt.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},nt.prototype.computeDirection=function(t){var e,i,o,s=t.angle.radian,n=Math.PI/4,r=Math.PI/2;if(s>n&&s<3*n&&!t.lockX?e="up":s>-n&&s<=n&&!t.lockY?e="left":s>3*-n&&s<=-n&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=s>-r&&s<r?"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 rt=nt;function at(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=at.id,at.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}at.prototype=new st,at.constructor=at,at.id=0,at.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}},at.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},at.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)}},at.prototype.createNipple=function(t,e){var i=this,o=i.manager.scroll,s={},n=i.options,r=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-r,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",n.zone.appendChild(h);var l=h.getBoundingClientRect();n.zone.removeChild(h),s=t,t={x:l.left+o.x,y:l.top+o.y}}var c=new rt(i,{color:n.color,size:n.size,threshold:n.threshold,fadeTime:n.fadeTime,dataOnly:n.dataOnly,restJoystick:n.restJoystick,restOpacity:n.restOpacity,mode:n.mode,identifier:e,position:t,zone:n.zone,frontPosition:{x:0,y:0},shape:n.shape});return n.dataOnly||(B(c.ui.el,s),B(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},at.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},at.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)},at.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)},at.prototype.onstart=function(t){var e=this,i=e.options,o=t;return t=Q(t),e.updateBox(),H(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},at.prototype.processOnStart=function(t){var e,i=this,o=i.options,s=i.manager.getIdentifier(t),n=t.force||t.pressure||t.webkitForce||0,r={x:t.pageX,y:t.pageY},a=i.getOrCreate(s,r);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(),n>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(!(N(r,a.position)<=o.catchDistance))return a.destroy(),void i.processOnStart(t);h(a)}return a},at.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)},at.prototype.processOnMove=function(t){var e=this,i=e.options,o=e.manager.getIdentifier(t),s=e.nipples.get(o),n=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 r=s.el.getBoundingClientRect();s.position={x:n.x+r.left,y:n.y+r.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=N(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=V(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=V(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=N(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+n.y)+"px",s.el.style.left=s.position.x-(e.box.left+n.x)+"px",d=N(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||B(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:V(180-m),degree:180-m},s.trigger("move",v),e.trigger("move "+s.id+":move",v)}else this.processOnEnd(t)},at.prototype.processOnEnd=function(t){var e=this,i=e.options,o=e.manager.getIdentifier(t),s=e.nipples.get(o),n=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[n.id]=n.identifier))},at.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()},at.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 ht=at;function lt(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=Y(),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=>{I.has(t)&&clearTimeout(I.get(t)),I.set(t,setTimeout(function(){I.delete(t),t()},100))})(i)},e._onScroll=function(){e.scroll=Y()},e.collections}lt.prototype=new st,lt.constructor=lt,lt.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}},lt.prototype.create=function(t){return this.createCollection(t)},lt.prototype.bindWindowEvents=function(){var t=this;t._windowBound||typeof window>"u"||(t._windowBound=!0,L(window,"resize",t._onResize),L(window,"scroll",t._onScroll))},lt.prototype.unbindWindowEvents=function(){var t=this;!t._windowBound||typeof window>"u"||(t._windowBound=!1,Z(window,"resize",t._onResize),Z(window,"scroll",t._onScroll))},lt.prototype.createCollection=function(t){var e=this,i=new ht(e,t);return e.bindCollection(i),e.collections.push(i),e.bindWindowEvents(),i},lt.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)},lt.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},lt.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||!0===t)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},lt.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]},lt.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},lt.prototype.onmove=function(t){return this.onAny("move",t),!1},lt.prototype.onend=function(t){return this.onAny("end",t),!1},lt.prototype.oncancel=function(t){return this.onAny("end",t),!1},lt.prototype.onAny=function(t,e){var i,o=this,s="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=Q(e);var n=function(t,e,i){i.ids.indexOf(e)>=0&&(i[s](t),t._found_=!0)};return H(e,function(t){i=o.getIdentifier(t),H(o.collections,n.bind(null,t,i)),t._found_||o.removeIdentifier(i)}),!1},lt.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()},lt.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 ct=lt,dt=null;function mt(){return dt||(dt=new ct),dt}var pt={create:function(t){return mt().create(t)},destroy:function(){dt&&(dt.destroy(),dt=null)},get factory(){return mt()}},ut=.02,yt=new C,gt=new C,ft=new C,vt=new C,bt=new C,xt=new C,wt=new O,Pt=new O,Mt=new O,Et=new D,St=new D,jt=new z(0,0,0,"YXZ"),At=new C(1,0,0),Tt=new C(0,1,0),kt=new C(0,0,1),Dt=new C(1,1,1),Ct=[],Ot=t=>Ct[t]??(Ct[t]=new C),zt=new C,Rt=new C,Ft=new C,_t=new C,Xt=new D,Wt=new C,Nt=new D,Vt=new R,It=new F,Lt={type:"requestRender"},Zt={type:"updateMatrix"},Qt=class extends A{constructor(t,i,o,s,n,r,a,h,p){super(),this.object=t,this.domElement=i,this.data=o,this.gloabalPhysics=s,this.controlsManager=n,this.cameraFollow=r,this.camera=a,this.page=h,this.sharedAssets=p,this.enableDamping=!0,this.hiddenMatrix0=new O,this.target0=new C,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=e,this.euler0=new z(0,0,0,"YXZ"),this.position0Cam=new C,this.quat0Cam=new D,this.scale0Cam=new C,this.hiddenMatrix0Cam=new O,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new R(new C(0,-40,0),new C(0,40,0)),matrix:new O,position:new C,rotation:new D},this.euler=new z(0,0,0,"YXZ"),this.eulerDelta=new C,this.lastPosition=new C,this.lastCameraQuaternion=new D,this.lastCameraPosition=new C,this.PI_2=Math.PI/2,this.prevMouse=new k,this.velocityTarget=new C,this.velocity=new C,this.directionXZ=new C,this.rotVelocityStick=new C,this.rotVelocityTarget=new C,this.rotVelocity=new C,this.rotDirection=new C,this.nonColliderRotOffset=new O,this.nonColliderPosOffset=new O,this.firstPointerId=-1,this.rot=new C,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 O,this.objectToTarget=new C,this.objectToTarget0=new C,this.objectToCamXZ=new C,this.objectToCamXZ0=new C,this.targetToCamera=new C,this.targetToCamera0=new C,this.cameraPolarAxis0=new C,this.targetPos=new C,this.targetQuat=new D,this.lerpFactorPos=(new C).setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new D,this.objXZQuatInv=new D,this.objXZRotMat=new O,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new C,this.pushedVelocity=new C,this.groundYRotation=0,this.objectRealQuat=new D,this.colliderWorldQuat=new D,this.groundNormal=new C,this.groundTilt=new D,this.groundTiltInv=new D,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new C,this.quaternion=new D,this.scale=new C,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?Qt.isLocked=!0:Qt.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=n.sharedGameControlGlobals,t===a&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let u=this.euler0.clone(),g=u.y;if(this.objectRealQuat.copy(this.quaternion),u.y=0,this.quaternion.setFromEuler(u),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),u.set(0,g,0),this.quaternion.setFromEuler(u),this.rot.setFromEuler(u),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.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let t,e=new C(0,0,-1).applyQuaternion(this.camera.quaternion),i=(new C).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 z).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 m&&(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??j.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??j.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??M.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*ut/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*ut/this.pixelsPerMeter,this.stepThresh=2*o.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*o.collider.radius):(this.offset=o.collider.height*ut/this.pixelsPerMeter,this.stepThresh=.3*o.collider.height/this.pixelsPerMeter,this.colliderHeight=o.collider.height),this.collider.type=o.collider.type;let v=(new C).fromArray(o.collider.position.map(t=>"number"==typeof t?t:0)),b=(new D).setFromEuler((new z).fromArray([...o.collider.rotation.map(t=>"number"==typeof t?t:0),"XYZ"]));this.collider.position.copy(v).multiply(this.scale),this.collider.rotation.copy(b),this.collider.matrix.compose(v,b,Dt),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 x=2*o.navmesh.destinationHelperRadius;if(x>0){let t=new S;t.push({fi:0,data:{...E.defaultData("light","phong"),alpha:0},id:"layer1"}),t.push({fi:0,data:{...E.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 W(f.create({parameters:{width:x,height:x/10,hollow:.7}}),e),this.navMeshPathDest.material.userData.opacity0=o.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),t){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let t=(new z).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 m?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.hiddenMatrix.copy(this.hiddenMatrix0Cam),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={},P.list.forEach(i=>{this.actions[i]=v({...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"),b(this.actions.idle),b(this.actions.move),b(this.actions.run),b(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 vt.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=bt.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,n=null===s?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(s.handle);if(null!==s&&n?.userData.isFollowingObj!==this.object.uuid){let t=this.object.getWorldPosition(vt).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=vt.subVectors(this.path[1],this.position),i=bt.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 n=ft.copy(this.velocity);if("none"!==this.orientMode&&!1===this.isFirstPerson){let t=bt.copy(n);t.y=0,n.set(0,n.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=vt;this.camera.getWorldDirection(t);let e=xt.copy(Tt).multiplyScalar(t.dot(Tt));t.sub(e);let i=bt.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(jt.setFromVector3(this.rot),"walk"===this.moveMode&&(jt.x=0),n.applyEuler(jt),o&&(St.setFromUnitVectors(Tt,this.groundNormal),n.applyQuaternion(St)),!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(zt,Xt,Rt);let o=this.object.getWorldPosition(Ft).add(this.collider.position).sub(zt);Nt.copy(i.prevQ).invert().premultiply(Xt);let r=xt.subVectors(zt,i.prevT).add(_t.copy(o).applyQuaternion(Nt).sub(o)).divideScalar(e).divideScalar(this.pixelsPerMeter),a=i.rigidBody.collider(0).castCollider(r,this.object.rigidBody.collider(0),vt.copy(n).divideScalar(this.pixelsPerMeter),0,e,!1);r.multiplyScalar(this.pixelsPerMeter);let h=x.is(i)?i:i.object;if(null!==a&&this.lastHitObj!==h){let t;i instanceof p&&(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(r.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=r.x),Math.abs(r.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=r.y),Math.abs(r.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=r.z),Ot(t++).copy(a.normal1).applyQuaternion(i.quaternion))}if(t>0){for(let e=0;e<t;e++){let t=Ot(e),i=t.dot(n);i<0&&n.addScaledVector(t,-i)}n.add(this.pushedVelocity)}else n.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(Tt,this.euler.y-this.euler0.y);let t=bt.copy(this.objectToCamXZ).normalize(),i=xt.copy(n).multiplyScalar(e);i.y=0;let o=i.sub(vt.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=T.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=T.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):"Limit"===this.cameraXAxis&&(this.euler.x=T.clamp(this.euler.x,-this.PI_2,this.PI_2))),"fly"===this.moveMode?this.rot.x=this.euler.x:this.isFirstPerson&&(jt.copy(this.euler),jt.y=0,this.nonColliderRotOffset.makeRotationFromEuler(jt)),Et.setFromAxisAngle(At,this.rot.x),St.setFromAxisAngle(Tt,this.rot.y),St.multiply(Et),Et.setFromAxisAngle(kt,this.rot.z),St.multiply(Et),this.quaternion.copy(St),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=bt.copy(n).multiplyScalar(e/this.pixelsPerMeter),i=null;this.didHit=!1;let o=new C;for(let e=0;e<5;e++){let n=t.length(),r=xt.copy(t).normalize();if(i=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,r,this.object.rigidBody.collider(0).shape,0,n,!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=yt.set(i.normal2.x,i.normal2.y,i.normal2.z).applyQuaternion(this.colliderWorldQuat),l=gt.copy(r).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(r,c)),t.copy(r).multiplyScalar(n-c),Math.acos(-h.y)>this.slopeThresh){let e=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),s=xt.copy(i.witness2).applyQuaternion(this.colliderWorldQuat);s.y=0;let n=e.add(s);n.y+=this.stepThresh;let r=this.sharedGameControlGlobals.rapierWorld.castShape(n,this.colliderWorldQuat,t,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);null!==r&&0===r.time_of_impact&&(h.y=0,h.normalize())}t.addScaledVector(h,-t.dot(h))}}this.position.addScaledVector(o,this.pixelsPerMeter),vt.copy(this.position).divideScalar(this.pixelsPerMeter),Et.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let r=this.object.rigidBody,a=void 0!==r&&Wt.copy(vt).sub(r.translation()).lengthSq()>1;void 0!==r&&(a?(r.setTranslation(vt,!0),r.setRotation(Et,!0)):(r.setNextKinematicTranslation(vt),r.setNextKinematicRotation(Et)))}else{let t=this.onObject?1:5,i=n.multiplyScalar(e/t);for(let o=0;o<t;o++)this.position.add(i),this.collisionAdjustment(e/t)}else this.position.addScaledVector(n,e);if("walk"===this.moveMode&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),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);wt.lookAt(e,t,Tt).setPosition(e),wt.decompose(this.targetPos,this.targetQuat,vt),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.updateMatrixWorld(),"Limit"===this.cameraYAxis&&"cartesian"===this.orientMode&&(this.euler.y=T.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=T.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(Lt),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=Et.setFromAxisAngle(Tt,"Limit"===this.cameraYAxis&&"radial"!==this.orientMode?T.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?T.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):T.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=vt.copy(this.cameraPolarAxis0);("Locked"!==this.cameraYAxis||"radial"===this.orientMode)&&i.applyQuaternion(e);let o=St.setFromAxisAngle(i,t);"Locked"!==this.cameraYAxis&&this.targetToCamera.applyQuaternion(e),"Locked"!==this.cameraXAxis&&this.targetToCamera.applyQuaternion(o)}groundTiltAdjustment(t){180*Tt.angleTo(t)/Math.PI<15||180*Tt.angleTo(t)/Math.PI>85?Et.identity():Et.setFromUnitVectors(Tt,t),this.groundTilt.slerp(Et,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=gt.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=wt.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(vt,Et,bt).compose(vt,Et,Dt);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(t=>{if(t===this.object||t.isDescendantOf(this.object)||!t.bvhGeometry||!t.bvhGeometry.boundsTree)return;It.makeEmpty(),t.updateMatrixWorldRigid();let o=t.matrixWorldRigid,s=Pt.copy(o).invert(),n=Mt.copy(Pt).multiply(i);Vt.copy(this.collider.segment),Vt.start.applyMatrix4(n),Vt.end.applyMatrix4(n);let r=yt.copy(this.position).applyMatrix4(s);It.expandByPoint(Vt.start),It.expandByPoint(Vt.end),It.min.addScalar(-this.collider.radius),It.max.addScalar(this.collider.radius),t.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:t=>t.distanceToPoint(Vt.end),intersectsBounds:t=>t.intersectsBox(It),intersectsTriangle:t=>{let i=vt,s=bt,n=t.closestPointToSegment(Vt,i,s);if(n<this.collider.radius){let t=this.collider.radius-n,a=s.sub(i).normalize(),h=xt.copy(r);h.addScaledVector(a,t);let l=h.applyMatrix4(o).sub(this.position);e.add(l),Vt.start.addScaledVector(a,t),Vt.end.addScaledVector(a,t)}}})}),It.makeEmpty(),Vt.copy(this.collider.segment),Vt.start.applyMatrix4(i),Vt.end.applyMatrix4(i),It.expandByPoint(Vt.start),It.expandByPoint(Vt.end),It.min.addScalar(-this.collider.radius),It.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:t=>t.distanceToPoint(Vt.end),intersectsBounds:t=>t.intersectsBox(It),intersectsTriangle:t=>{let i=vt,o=bt,s=t.closestPointToSegment(Vt,i,o);if(s<this.collider.radius){let t=this.collider.radius-s,n=o.sub(i).normalize();this.alignToGround&&this.groundTiltAdjustment(n),e.addScaledVector(n,t),Vt.start.addScaledVector(n,t),Vt.end.addScaledVector(n,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()}},Yt=Qt;Yt.isLocked=!1;var Bt,Gt,qt,Ut={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};r.then(t=>{Bt=t,Gt=new t.Vec3,qt=new t.Vec3});var Ht=new C,Kt=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=Ht.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 r;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;r=s.object}else if(s instanceof p)r=s.object;else if(r=s,!1===r.dataPatched.cloner?.disabled&&r.dataPatched.cloner?.hideBase&&!0!==r.dataPatched.physics?.fusedBody)return!0;if(i&&!r.userData.navmesh)return;let a=r.dataPatched;if(!a.visible&&!0!==a.physics?.enabled)return!0;s.updateMatrixWorldRigid();let h=n(a),l=r.userData.hasDestroy,c=r.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 n;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;n=i.object}else if(i instanceof p)n=i.object;else if(n=i,i.dataPatched.cloner?.hideBase)return!0;let r=n.dataPatched;if(!r.visible&&!0!==r.physics?.enabled)return!0;"geometry"in i&&i.geometry&&e.push(o(i.geometry,i.matrixWorld))}),!0},this.traverseNoPhysics=(e,i)=>s=>{let r;if(s instanceof t)return;r=s instanceof p?s.object:s;let a=r.dataPatched;if("visibility"===a.physics.enabled?!a.visible:!a.physics.enabled)return!0;if(i&&!r.userData.navmesh)return;let h=s.geometry,l=!0===r.userData.hasDestroy,c=!0===r.userData.hasDrag;if(n(a)||l||c||r.dataPatched.events.some(t=>!0!==t.data.disabled&&"GameControl"===t.data.type))return!0;h&&e.push(o(h,s.matrixWorld))},this.navmeshWasm=Bt,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(i?(s=a??"https://cdn.spline.design/@splinetool/runtime@2.0.4/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 C).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 n=g(o),{positions:r,triIndices:a}=u(n.getAttribute("position"),n.getIndex());return this._worker.postMessage([r,r.length/3,a,a.length,{...Ut,...e}]),this._worker.onmessage=i,!0}createDebugNavGeometry(){let t,e,i=this.navMesh.getDebugNavMesh(),o=i.getTriangleCount(),s=new Uint32Array(3*o),n=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);n[9*t+3*e+0]=o.x,n[9*t+3*e+1]=o.y,n[9*t+3*e+2]=o.z}let r=new X;return r.setIndex(new _(s,1)),r.setAttribute("position",new _(n,3)),r}getClosestPoint(t){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,this.navMesh.getClosestPoint(Gt)}getClosestPointToRef(t,e){Gt.x=t.x,Gt.y=t.y,Gt.z=t.z;let i=this.navMesh.getClosestPoint(Gt);e.set(i.x,i.y,i.z)}getRandomPointAround(t,e){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,this.navMesh.getRandomPointAround(Gt,e)}getRandomPointAroundToRef(t,e,i){Gt.x=t.x,Gt.y=t.y,Gt.z=t.z;let o=this.navMesh.getRandomPointAround(Gt,e);i.set(o.x,o.y,o.z)}moveAlong(t,e){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,qt.x=e.x,qt.y=e.y,qt.z=e.z,this.navMesh.moveAlong(Gt,qt)}moveAlongToRef(t,e,i){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,qt.x=e.x,qt.y=e.y,qt.z=e.z,this.navMesh.moveAlong(Gt,qt)}computePath(t,e){let i=this.getClosestPoint(e);if(qt.x=i.x,qt.y=i.y,qt.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(Gt,qt),s=o.getPointCount(),n=[];for(let t=0;t<s;t++){let e=o.getPoint(t);n.push(new C(e.x,e.y,e.z))}return n}createCrowd(t,e){return new Jt(this,t,e)}setDefaultQueryExtent(t){Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,this.navMesh.setDefaultQueryExtent(Gt)}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 Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,this.navMesh.addCylinderObstacle(Gt,e,i)}addBoxObstacle(t,e,i){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,qt.x=e.x,qt.y=e.y,qt.z=e.z,this.navMesh.addBoxObstacle(Gt,qt,i)}removeObstacle(t){this.navMesh.removeObstacle(t)}isSupported(){return void 0!==this.navmeshWasm}},Jt=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 C(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,n=this.reachRadii[t],r=this._agentDestination[t].y-this.reachRadii[t],a=this._agentDestination[t].y+this.reachRadii[t],h=o*o+s*s;i.y>r&&i.y<a&&h<n*n&&(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 C(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,n=8,r=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 Yt(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,n=d.joystickRotLoc,r=d.jumpTouchButtonLoc,a=d.rotByTouch,l&&d.touchControl&&(e.joystickToGameControls[s]="pos","walk"===d.moveMode&&(e.joystickToGameControls[r]="jmp"),"joystick"===a&&(e.joystickToGameControls[n]="rot"))}if(e.gameControl&&e.gameControl.data.navmesh.enabled){let i=e.gameControl.data;if(!e.navigationMeshWrapper){let o;e.navigationMeshWrapper=new Kt(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 n=document.body.appendChild(document.createElement("div")),[r,a,h]=t.eventManager.eventContext.publish.joystickSizeAndXYOffset[s],l=(e-5*r)/4+r,c={},d="jmp"===o,m=d?0:r;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=n.appendChild(document.createElement("div"));Object.assign(e.style,c,{position:"absolute",width:r+"px",height:r+"px",backgroundColor:`rgba(255,255,255,${"show"===h?.4:0})`,zIndex:"9999",borderRadius:r+"px",border:"show"===h?"solid 2px rgba(0, 0, 0, .1)":"none",display:"flex",alignItems:"center",justifyContent:"center",touchAction:"none"});let i=r/16*16*.4;return"show"===h&&(e.innerHTML=`\n\t\t\t\t\t\t<svg width="${i}" height="${.4*r}" 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,n])}let p={zone:n,mode:"static",position:c,size:r};"hide"===h&&(p.restOpacity=0);let u=pt.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,n]})}}),w("game-controls");
|
|
1
|
+
import{a as t}from"./runtime-chunk-PUBEJSJO.js";import"./runtime-chunk-RRXSRYPQ.js";import{c as e,d as i,f as o,g as s,i as n,k as r,l as a}from"./runtime-chunk-3KIZF7P5.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{a as m}from"./runtime-chunk-H7D3VFTJ.js";import"./runtime-chunk-JQ3A6ENO.js";import"./runtime-chunk-XUM5HEC6.js";import"./runtime-chunk-ITLS6YIC.js";import"./runtime-chunk-4E4NQ6GS.js";import"./runtime-chunk-AKWBEROQ.js";import{$ as p,G as u,N as y,a as g,p as f}from"./runtime-chunk-SXPM42HJ.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{f as v,g as b}from"./runtime-chunk-NWCLOXDY.js";import{h as x}from"./runtime-chunk-4KX4KQWR.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-R34HNX2O.js";import{a as w}from"./runtime-chunk-TZCHGFVF.js";import{Ka as P,La as M,ea as E,g as S,ua as j}from"./runtime-chunk-RBM3UDQF.js";import{Bc as A,Cc as T,Dc as D,Ec as k,Fc as C,Oc as O,Pc as z,Re as R,Xc as F,Zc as _,dd as X,ld as W}from"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var N=(t,e)=>{let i=e.x-t.x,o=e.y-t.y;return Math.sqrt(i*i+o*o)},V=t=>t*(Math.PI/180),I=new Map,L=(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)},Q=(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)},B=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),Y=()=>{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}},Z=(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")},G=(t,e,i)=>{let o=q(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},q=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},U=(t,e)=>{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},H=(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"&&(K="ontouchstart"in window,J=!!window.PointerEvent,$=!!window.MSPointerEvent);var K,J,$,tt,et={start:"mousedown",move:"mousemove",end:"mouseup"},it={};function ot(){}J?tt={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:$?tt={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:K?(tt={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},it=et):tt=et,ot.prototype.on=function(t,e){var i,o=this,s=t.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var n=0;n<s.length;n+=1)i=s[n],o._handlers_[i]=o._handlers_[i]||[],o._handlers_[i].push(e);return o},ot.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},ot.prototype.trigger=function(t,e){var i,o=this,s=t.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var n=0;n<s.length;n+=1)i=s[n],o._handlers_[i]&&o._handlers_[i].length&&o._handlers_[i].forEach(function(t){t.call(o,{type:i,target:o},e)})},ot.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))},ot.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.')},L(t,tt[e],i._domHandlers_[e]),it[e]&&L(t,it[e],i._domHandlers_[e]),i},ot.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},Q(t,tt[e],i._domHandlers_[e]),it[e]&&Q(t,it[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var st=ot;function nt(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=nt.id,nt.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}nt.prototype=new st,nt.constructor=nt,nt.id=0,nt.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},nt.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=(()=>{let t=q("borderRadius");for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e]="50%");return t})(),i=G("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)"},U(o.el,i),"circle"===this.options.shape&&U(o.back,e),U(o.front,e),this.applyStyles(o),this},nt.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},nt.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},nt.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},nt.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},nt.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},nt.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},nt.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=G("transition",["top","left"],o);var n={front:{}};n.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(s),i.applyStyles(n),i.restTimeout=setTimeout(function(){"function"==typeof t&&t.call(i),i.restCallback()},i.options.fadeTime)},nt.prototype.restCallback=function(){var t=this,e={};e.front=G("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},nt.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},nt.prototype.computeDirection=function(t){var e,i,o,s=t.angle.radian,n=Math.PI/4,r=Math.PI/2;if(s>n&&s<3*n&&!t.lockX?e="up":s>-n&&s<=n&&!t.lockY?e="left":s>3*-n&&s<=-n&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=s>-r&&s<r?"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 rt=nt;function at(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=at.id,at.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}at.prototype=new st,at.constructor=at,at.id=0,at.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}},at.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},at.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)}},at.prototype.createNipple=function(t,e){var i=this,o=i.manager.scroll,s={},n=i.options,r=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-r,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",n.zone.appendChild(h);var l=h.getBoundingClientRect();n.zone.removeChild(h),s=t,t={x:l.left+o.x,y:l.top+o.y}}var c=new rt(i,{color:n.color,size:n.size,threshold:n.threshold,fadeTime:n.fadeTime,dataOnly:n.dataOnly,restJoystick:n.restJoystick,restOpacity:n.restOpacity,mode:n.mode,identifier:e,position:t,zone:n.zone,frontPosition:{x:0,y:0},shape:n.shape});return n.dataOnly||(Z(c.ui.el,s),Z(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},at.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},at.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)},at.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)},at.prototype.onstart=function(t){var e=this,i=e.options,o=t;return t=B(t),e.updateBox(),H(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},at.prototype.processOnStart=function(t){var e,i=this,o=i.options,s=i.manager.getIdentifier(t),n=t.force||t.pressure||t.webkitForce||0,r={x:t.pageX,y:t.pageY},a=i.getOrCreate(s,r);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(),n>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(!(N(r,a.position)<=o.catchDistance))return a.destroy(),void i.processOnStart(t);h(a)}return a},at.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)},at.prototype.processOnMove=function(t){var e=this,i=e.options,o=e.manager.getIdentifier(t),s=e.nipples.get(o),n=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 r=s.el.getBoundingClientRect();s.position={x:n.x+r.left,y:n.y+r.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=N(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=V(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=V(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=N(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+n.y)+"px",s.el.style.left=s.position.x-(e.box.left+n.x)+"px",d=N(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||Z(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:V(180-m),degree:180-m},s.trigger("move",v),e.trigger("move "+s.id+":move",v)}else this.processOnEnd(t)},at.prototype.processOnEnd=function(t){var e=this,i=e.options,o=e.manager.getIdentifier(t),s=e.nipples.get(o),n=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[n.id]=n.identifier))},at.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()},at.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 ht=at;function lt(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=Y(),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=>{I.has(t)&&clearTimeout(I.get(t)),I.set(t,setTimeout(function(){I.delete(t),t()},100))})(i)},e._onScroll=function(){e.scroll=Y()},e.collections}lt.prototype=new st,lt.constructor=lt,lt.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}},lt.prototype.create=function(t){return this.createCollection(t)},lt.prototype.bindWindowEvents=function(){var t=this;t._windowBound||typeof window>"u"||(t._windowBound=!0,L(window,"resize",t._onResize),L(window,"scroll",t._onScroll))},lt.prototype.unbindWindowEvents=function(){var t=this;!t._windowBound||typeof window>"u"||(t._windowBound=!1,Q(window,"resize",t._onResize),Q(window,"scroll",t._onScroll))},lt.prototype.createCollection=function(t){var e=this,i=new ht(e,t);return e.bindCollection(i),e.collections.push(i),e.bindWindowEvents(),i},lt.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)},lt.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},lt.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||!0===t)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},lt.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]},lt.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},lt.prototype.onmove=function(t){return this.onAny("move",t),!1},lt.prototype.onend=function(t){return this.onAny("end",t),!1},lt.prototype.oncancel=function(t){return this.onAny("end",t),!1},lt.prototype.onAny=function(t,e){var i,o=this,s="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=B(e);var n=function(t,e,i){i.ids.indexOf(e)>=0&&(i[s](t),t._found_=!0)};return H(e,function(t){i=o.getIdentifier(t),H(o.collections,n.bind(null,t,i)),t._found_||o.removeIdentifier(i)}),!1},lt.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()},lt.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 ct=lt,dt=null;function mt(){return dt||(dt=new ct),dt}var pt={create:function(t){return mt().create(t)},destroy:function(){dt&&(dt.destroy(),dt=null)},get factory(){return mt()}},ut=.02,yt=new C,gt=new C,ft=new C,vt=new C,bt=new C,xt=new C,wt=new O,Pt=new O,Mt=new O,Et=new k,St=new k,jt=new z(0,0,0,"YXZ"),At=new C(1,0,0),Tt=new C(0,1,0),Dt=new C(0,0,1),kt=new C(1,1,1),Ct=[],Ot=t=>Ct[t]??(Ct[t]=new C),zt=new C,Rt=new C,Ft=new C,_t=new C,Xt=new k,Wt=new C,Nt=new k,Vt=new R,It=new F,Lt={type:"requestRender"},Qt={type:"updateMatrix"},Bt=class extends A{constructor(t,i,o,s,n,r,a,h,p){super(),this.object=t,this.domElement=i,this.data=o,this.gloabalPhysics=s,this.controlsManager=n,this.cameraFollow=r,this.camera=a,this.page=h,this.sharedAssets=p,this.enableDamping=!0,this.hiddenMatrix0=new O,this.target0=new C,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=e,this.euler0=new z(0,0,0,"YXZ"),this.position0Cam=new C,this.quat0Cam=new k,this.scale0Cam=new C,this.hiddenMatrix0Cam=new O,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new R(new C(0,-40,0),new C(0,40,0)),matrix:new O,position:new C,rotation:new k},this.euler=new z(0,0,0,"YXZ"),this.eulerDelta=new C,this.lastPosition=new C,this.lastCameraQuaternion=new k,this.lastCameraPosition=new C,this.PI_2=Math.PI/2,this.prevMouse=new D,this.velocityTarget=new C,this.velocity=new C,this.directionXZ=new C,this.rotVelocityStick=new C,this.rotVelocityTarget=new C,this.rotVelocity=new C,this.rotDirection=new C,this.nonColliderRotOffset=new O,this.nonColliderPosOffset=new O,this.firstPointerId=-1,this.rot=new C,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 O,this.objectToTarget=new C,this.objectToTarget0=new C,this.objectToCamXZ=new C,this.objectToCamXZ0=new C,this.targetToCamera=new C,this.targetToCamera0=new C,this.cameraPolarAxis0=new C,this.targetPos=new C,this.targetQuat=new k,this.lerpFactorPos=(new C).setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new k,this.objXZQuatInv=new k,this.objXZRotMat=new O,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new C,this.pushedVelocity=new C,this.groundYRotation=0,this.objectRealQuat=new k,this.colliderWorldQuat=new k,this.groundNormal=new C,this.groundTilt=new k,this.groundTiltInv=new k,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new C,this.quaternion=new k,this.scale=new C,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?Bt.isLocked=!0:Bt.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=n.sharedGameControlGlobals,t===a&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let u=this.euler0.clone(),g=u.y;if(this.objectRealQuat.copy(this.quaternion),u.y=0,this.quaternion.setFromEuler(u),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),u.set(0,g,0),this.quaternion.setFromEuler(u),this.rot.setFromEuler(u),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.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let t,e=new C(0,0,-1).applyQuaternion(this.camera.quaternion),i=(new C).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 z).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 m&&(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??j.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??j.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??M.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*ut/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*ut/this.pixelsPerMeter,this.stepThresh=2*o.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*o.collider.radius):(this.offset=o.collider.height*ut/this.pixelsPerMeter,this.stepThresh=.3*o.collider.height/this.pixelsPerMeter,this.colliderHeight=o.collider.height),this.collider.type=o.collider.type;let v=(new C).fromArray(o.collider.position.map(t=>"number"==typeof t?t:0)),b=(new k).setFromEuler((new z).fromArray([...o.collider.rotation.map(t=>"number"==typeof t?t:0),"XYZ"]));this.collider.position.copy(v).multiply(this.scale),this.collider.rotation.copy(b),this.collider.matrix.compose(v,b,kt),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 x=2*o.navmesh.destinationHelperRadius;if(x>0){let t=new S;t.push({fi:0,data:{...E.defaultData("light","phong"),alpha:0},id:"layer1"}),t.push({fi:0,data:{...E.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 W(f.create({parameters:{width:x,height:x/10,hollow:.7}}),e),this.navMeshPathDest.material.userData.opacity0=o.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),t){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let t=(new z).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 m?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.hiddenMatrix.copy(this.hiddenMatrix0Cam),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={},P.list.forEach(i=>{this.actions[i]=v({...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"),b(this.actions.idle),b(this.actions.move),b(this.actions.run),b(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 vt.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=bt.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,n=null===s?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(s.handle);if(null!==s&&n?.userData.isFollowingObj!==this.object.uuid){let t=this.object.getWorldPosition(vt).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=vt.subVectors(this.path[1],this.position),i=bt.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 n=ft.copy(this.velocity);if("none"!==this.orientMode&&!1===this.isFirstPerson){let t=bt.copy(n);t.y=0,n.set(0,n.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=vt;this.camera.getWorldDirection(t);let e=xt.copy(Tt).multiplyScalar(t.dot(Tt));t.sub(e);let i=bt.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(jt.setFromVector3(this.rot),"walk"===this.moveMode&&(jt.x=0),n.applyEuler(jt),o&&(St.setFromUnitVectors(Tt,this.groundNormal),n.applyQuaternion(St)),!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(zt,Xt,Rt);let o=this.object.getWorldPosition(Ft).add(this.collider.position).sub(zt);Nt.copy(i.prevQ).invert().premultiply(Xt);let r=xt.subVectors(zt,i.prevT).add(_t.copy(o).applyQuaternion(Nt).sub(o)).divideScalar(e).divideScalar(this.pixelsPerMeter),a=i.rigidBody.collider(0).castCollider(r,this.object.rigidBody.collider(0),vt.copy(n).divideScalar(this.pixelsPerMeter),0,e,!1);r.multiplyScalar(this.pixelsPerMeter);let h=x.is(i)?i:i.object;if(null!==a&&this.lastHitObj!==h){let t;i instanceof p&&(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(r.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=r.x),Math.abs(r.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=r.y),Math.abs(r.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=r.z),Ot(t++).copy(a.normal1).applyQuaternion(i.quaternion))}if(t>0){for(let e=0;e<t;e++){let t=Ot(e),i=t.dot(n);i<0&&n.addScaledVector(t,-i)}n.add(this.pushedVelocity)}else n.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(Tt,this.euler.y-this.euler0.y);let t=bt.copy(this.objectToCamXZ).normalize(),i=xt.copy(n).multiplyScalar(e);i.y=0;let o=i.sub(vt.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=T.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=T.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):"Limit"===this.cameraXAxis&&(this.euler.x=T.clamp(this.euler.x,-this.PI_2,this.PI_2))),"fly"===this.moveMode?this.rot.x=this.euler.x:this.isFirstPerson&&(jt.copy(this.euler),jt.y=0,this.nonColliderRotOffset.makeRotationFromEuler(jt)),Et.setFromAxisAngle(At,this.rot.x),St.setFromAxisAngle(Tt,this.rot.y),St.multiply(Et),Et.setFromAxisAngle(Dt,this.rot.z),St.multiply(Et),this.quaternion.copy(St),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=bt.copy(n).multiplyScalar(e/this.pixelsPerMeter),i=null;this.didHit=!1;let o=new C;for(let e=0;e<5;e++){let n=t.length(),r=xt.copy(t).normalize();if(i=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,r,this.object.rigidBody.collider(0).shape,0,n,!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=yt.set(i.normal2.x,i.normal2.y,i.normal2.z).applyQuaternion(this.colliderWorldQuat),l=gt.copy(r).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(r,c)),t.copy(r).multiplyScalar(n-c),Math.acos(-h.y)>this.slopeThresh){let e=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),s=xt.copy(i.witness2).applyQuaternion(this.colliderWorldQuat);s.y=0;let n=e.add(s);n.y+=this.stepThresh;let r=this.sharedGameControlGlobals.rapierWorld.castShape(n,this.colliderWorldQuat,t,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);null!==r&&0===r.time_of_impact&&(h.y=0,h.normalize())}t.addScaledVector(h,-t.dot(h))}}this.position.addScaledVector(o,this.pixelsPerMeter),vt.copy(this.position).divideScalar(this.pixelsPerMeter),Et.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let r=this.object.rigidBody,a=void 0!==r&&Wt.copy(vt).sub(r.translation()).lengthSq()>1;void 0!==r&&(a?(r.setTranslation(vt,!0),r.setRotation(Et,!0)):(r.setNextKinematicTranslation(vt),r.setNextKinematicRotation(Et)))}else{let t=this.onObject?1:5,i=n.multiplyScalar(e/t);for(let o=0;o<t;o++)this.position.add(i),this.collisionAdjustment(e/t)}else this.position.addScaledVector(n,e);if("walk"===this.moveMode&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),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);wt.lookAt(e,t,Tt).setPosition(e),wt.decompose(this.targetPos,this.targetQuat,vt),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.updateMatrixWorld(),"Limit"===this.cameraYAxis&&"cartesian"===this.orientMode&&(this.euler.y=T.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=T.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(Qt),!(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(Lt),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=Et.setFromAxisAngle(Tt,"Limit"===this.cameraYAxis&&"radial"!==this.orientMode?T.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?T.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):T.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=vt.copy(this.cameraPolarAxis0);("Locked"!==this.cameraYAxis||"radial"===this.orientMode)&&i.applyQuaternion(e);let o=St.setFromAxisAngle(i,t);"Locked"!==this.cameraYAxis&&this.targetToCamera.applyQuaternion(e),"Locked"!==this.cameraXAxis&&this.targetToCamera.applyQuaternion(o)}groundTiltAdjustment(t){180*Tt.angleTo(t)/Math.PI<15||180*Tt.angleTo(t)/Math.PI>85?Et.identity():Et.setFromUnitVectors(Tt,t),this.groundTilt.slerp(Et,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=gt.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=wt.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(vt,Et,bt).compose(vt,Et,kt);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(t=>{if(t===this.object||t.isDescendantOf(this.object)||!t.bvhGeometry||!t.bvhGeometry.boundsTree)return;It.makeEmpty(),t.updateMatrixWorldRigid();let o=t.matrixWorldRigid,s=Pt.copy(o).invert(),n=Mt.copy(Pt).multiply(i);Vt.copy(this.collider.segment),Vt.start.applyMatrix4(n),Vt.end.applyMatrix4(n);let r=yt.copy(this.position).applyMatrix4(s);It.expandByPoint(Vt.start),It.expandByPoint(Vt.end),It.min.addScalar(-this.collider.radius),It.max.addScalar(this.collider.radius),t.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:t=>t.distanceToPoint(Vt.end),intersectsBounds:t=>t.intersectsBox(It),intersectsTriangle:t=>{let i=vt,s=bt,n=t.closestPointToSegment(Vt,i,s);if(n<this.collider.radius){let t=this.collider.radius-n,a=s.sub(i).normalize(),h=xt.copy(r);h.addScaledVector(a,t);let l=h.applyMatrix4(o).sub(this.position);e.add(l),Vt.start.addScaledVector(a,t),Vt.end.addScaledVector(a,t)}}})}),It.makeEmpty(),Vt.copy(this.collider.segment),Vt.start.applyMatrix4(i),Vt.end.applyMatrix4(i),It.expandByPoint(Vt.start),It.expandByPoint(Vt.end),It.min.addScalar(-this.collider.radius),It.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:t=>t.distanceToPoint(Vt.end),intersectsBounds:t=>t.intersectsBox(It),intersectsTriangle:t=>{let i=vt,o=bt,s=t.closestPointToSegment(Vt,i,o);if(s<this.collider.radius){let t=this.collider.radius-s,n=o.sub(i).normalize();this.alignToGround&&this.groundTiltAdjustment(n),e.addScaledVector(n,t),Vt.start.addScaledVector(n,t),Vt.end.addScaledVector(n,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()}},Yt=Bt;Yt.isLocked=!1;var Zt,Gt,qt,Ut={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};r.then(t=>{Zt=t,Gt=new t.Vec3,qt=new t.Vec3});var Ht=new C,Kt=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=Ht.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 r;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;r=s.object}else if(s instanceof p)r=s.object;else if(r=s,!1===r.dataPatched.cloner?.disabled&&r.dataPatched.cloner?.hideBase&&!0!==r.dataPatched.physics?.fusedBody)return!0;if(i&&!r.userData.navmesh)return;let a=r.dataPatched;if(!a.visible&&!0!==a.physics?.enabled)return!0;s.updateMatrixWorldRigid();let h=n(a),l=r.userData.hasDestroy,c=r.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 n;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;n=i.object}else if(i instanceof p)n=i.object;else if(n=i,i.dataPatched.cloner?.hideBase)return!0;let r=n.dataPatched;if(!r.visible&&!0!==r.physics?.enabled)return!0;"geometry"in i&&i.geometry&&e.push(o(i.geometry,i.matrixWorld))}),!0},this.traverseNoPhysics=(e,i)=>s=>{let r;if(s instanceof t)return;r=s instanceof p?s.object:s;let a=r.dataPatched;if("visibility"===a.physics.enabled?!a.visible:!a.physics.enabled)return!0;if(i&&!r.userData.navmesh)return;let h=s.geometry,l=!0===r.userData.hasDestroy,c=!0===r.userData.hasDrag;if(n(a)||l||c||r.dataPatched.events.some(t=>!0!==t.data.disabled&&"GameControl"===t.data.type))return!0;h&&e.push(o(h,s.matrixWorld))},this.navmeshWasm=Zt,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(i?(s=a??"https://cdn.spline.design/@splinetool/runtime@2.0.6/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 C).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 n=g(o),{positions:r,triIndices:a}=u(n.getAttribute("position"),n.getIndex());return this._worker.postMessage([r,r.length/3,a,a.length,{...Ut,...e}]),this._worker.onmessage=i,!0}createDebugNavGeometry(){let t,e,i=this.navMesh.getDebugNavMesh(),o=i.getTriangleCount(),s=new Uint32Array(3*o),n=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);n[9*t+3*e+0]=o.x,n[9*t+3*e+1]=o.y,n[9*t+3*e+2]=o.z}let r=new X;return r.setIndex(new _(s,1)),r.setAttribute("position",new _(n,3)),r}getClosestPoint(t){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,this.navMesh.getClosestPoint(Gt)}getClosestPointToRef(t,e){Gt.x=t.x,Gt.y=t.y,Gt.z=t.z;let i=this.navMesh.getClosestPoint(Gt);e.set(i.x,i.y,i.z)}getRandomPointAround(t,e){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,this.navMesh.getRandomPointAround(Gt,e)}getRandomPointAroundToRef(t,e,i){Gt.x=t.x,Gt.y=t.y,Gt.z=t.z;let o=this.navMesh.getRandomPointAround(Gt,e);i.set(o.x,o.y,o.z)}moveAlong(t,e){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,qt.x=e.x,qt.y=e.y,qt.z=e.z,this.navMesh.moveAlong(Gt,qt)}moveAlongToRef(t,e,i){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,qt.x=e.x,qt.y=e.y,qt.z=e.z,this.navMesh.moveAlong(Gt,qt)}computePath(t,e){let i=this.getClosestPoint(e);if(qt.x=i.x,qt.y=i.y,qt.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(Gt,qt),s=o.getPointCount(),n=[];for(let t=0;t<s;t++){let e=o.getPoint(t);n.push(new C(e.x,e.y,e.z))}return n}createCrowd(t,e){return new Jt(this,t,e)}setDefaultQueryExtent(t){Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,this.navMesh.setDefaultQueryExtent(Gt)}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 Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,this.navMesh.addCylinderObstacle(Gt,e,i)}addBoxObstacle(t,e,i){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,qt.x=e.x,qt.y=e.y,qt.z=e.z,this.navMesh.addBoxObstacle(Gt,qt,i)}removeObstacle(t){this.navMesh.removeObstacle(t)}isSupported(){return void 0!==this.navmeshWasm}},Jt=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 C(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,n=this.reachRadii[t],r=this._agentDestination[t].y-this.reachRadii[t],a=this._agentDestination[t].y+this.reachRadii[t],h=o*o+s*s;i.y>r&&i.y<a&&h<n*n&&(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 C(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,n=8,r=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 Yt(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,n=d.joystickRotLoc,r=d.jumpTouchButtonLoc,a=d.rotByTouch,l&&d.touchControl&&(e.joystickToGameControls[s]="pos","walk"===d.moveMode&&(e.joystickToGameControls[r]="jmp"),"joystick"===a&&(e.joystickToGameControls[n]="rot"))}if(e.gameControl&&e.gameControl.data.navmesh.enabled){let i=e.gameControl.data;if(!e.navigationMeshWrapper){let o;e.navigationMeshWrapper=new Kt(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 n=document.body.appendChild(document.createElement("div")),[r,a,h]=t.eventManager.eventContext.publish.joystickSizeAndXYOffset[s],l=(e-5*r)/4+r,c={},d="jmp"===o,m=d?0:r;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=n.appendChild(document.createElement("div"));Object.assign(e.style,c,{position:"absolute",width:r+"px",height:r+"px",backgroundColor:`rgba(255,255,255,${"show"===h?.4:0})`,zIndex:"9999",borderRadius:r+"px",border:"show"===h?"solid 2px rgba(0, 0, 0, .1)":"none",display:"flex",alignItems:"center",justifyContent:"center",touchAction:"none"});let i=r/16*16*.4;return"show"===h&&(e.innerHTML=`\n\t\t\t\t\t\t<svg width="${i}" height="${.4*r}" 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,n])}let p={zone:n,mode:"static",position:c,size:r};"hide"===h&&(p.restOpacity=0);let u=pt.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,n]})}}),w("game-controls");
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{k as r}from"./runtime-chunk-HUFJRFTO.js";import"./runtime-chunk-4KX4KQWR.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-R34HNX2O.js";import{a as i,d as m}from"./runtime-chunk-TZCHGFVF.js";import"./runtime-chunk-RBM3UDQF.js";import"./runtime-chunk-VGN7YHB7.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\`\ק|��;�S����p���beE��0iG��B����.�:�S��+i�&�����ݧI<�p�*:�.�礖[ꤪJ�K��_K���0�4�����R
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e}from"./runtime-chunk-
|
|
1
|
+
import{b as e}from"./runtime-chunk-XUM5HEC6.js";import"./runtime-chunk-ITLS6YIC.js";import{a as r}from"./runtime-chunk-SXPM42HJ.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{v as t}from"./runtime-chunk-4KX4KQWR.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-R34HNX2O.js";import"./runtime-chunk-TZCHGFVF.js";import{fa as i}from"./runtime-chunk-RBM3UDQF.js";import{ld as n}from"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";function a(e){let r;if(e.index)for(let t=0;t<e.index.array.length;t+=3)r=e.index.array[t],e.index.array[t]=e.index.array[t+2],e.index.array[t+2]=r}function o(r){return r instanceof e?"SubdivObject":"NonParametricGeometry"===r.geometry.type?"NonParametric":"Mesh"}function l(e,l){let s=function(e,r){let n={};return e.traverseEntity(e=>{if(!e.visible||!(e instanceof t)||"Mesh"!==e.type||Array.isArray(e.material)||e.states&&Object.keys(e.states).length)return;let a=e.parent;for(;a;){if(a instanceof t&&e.states&&Object.keys(e.states).length)return;a=a.parent}let l=e.material.uuid,s=r.shared.materials[l];if(s){if(!i.isMergable(s))return}else{let t=r.scene.objects.get(e.uuid)?.data;if(t&&"material"in t&&"string"!=typeof t.material){if(!i.isMergable(t.material))return;l=i.getHash(t.material)}}n[l]||(n[l]={});let u=n[l][o(e)];if(u){if(u.push(e),e.cloner)for(let r of e.cloner.children)u.push(r)}else if(n[l][o(e)]=[e],e.cloner)for(let r of e.cloner.children)n[l][o(e)].push(r)}),n}(l,e),u=function(e){let r=0;return Object.values(e).forEach(e=>{Object.values(e).forEach(e=>{let t=e.length;t>r&&(r=t)})}),r}(s),c=new Array(u),m=0,f=new Array(u),h=0,d=new Array(u),p=0,j=new Array(u),y=0;for(let[e,i]of Object.entries(s))for(let u of Object.values(i)){if(h=0,p=0,u.forEach(e=>{e instanceof t&&(f[h++]=e.geometry.clone(),d[p++]=e)}),p<2)continue;for(let e=0;e<p;e++)d[e].updateWorldMatrix(!0,!1),f[e].applyMatrix4(d[e].matrixWorld),d[e].matrixWorld.determinant()<0&&a(f[e]);let i=r(f.slice(0,h),!1);if(i){let r;"SubdivObject"===e?(console.warn("Turning subdiv object into mesh"),r=new n(i,d[0].material)):r=new n(i,d[0].material),r.castShadow=d[0].castShadow,r.receiveShadow=d[0].receiveShadow,l.add(r);let a=e=>{y=0;for(let r of e)r.children&&a(r.children),r instanceof t&&(Array.isArray(r.material)||s[r.material.uuid]&&s[r.material.uuid][o(r)]&&s[r.material.uuid][o(r)].length>1||(j[y++]=r));for(let e=0;e<y;e++)l.attach(j[e])};for(let e=0;e<p;e++){let r=d[e];a(r.children),c[m++]=r}}}for(let e=0;e<m;e++)c[e].removeFromParent()}export{l as mergeStaticGeometries,a as reverseWindingOrder};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./runtime-chunk-
|
|
1
|
+
import"./runtime-chunk-MM2G3DLE.js";import{g as t}from"./runtime-chunk-CCJD7IX7.js";import"./runtime-chunk-FY3XD5P2.js";import"./runtime-chunk-NTUTXO7Q.js";import{a as e}from"./runtime-chunk-LX3KCQF6.js";import{a}from"./runtime-chunk-R43XZP65.js";import"./runtime-chunk-CX2MRLZA.js";import"./runtime-chunk-4DNX5FPP.js";import"./runtime-chunk-GN3HDYV2.js";import"./runtime-chunk-XXRCB3ME.js";import"./runtime-chunk-TU4KDRKR.js";import"./runtime-chunk-FTVQTRM7.js";import{a as i,b as r}from"./runtime-chunk-VAVYZ35B.js";import{a as s,c as o}from"./runtime-chunk-FQNSP44B.js";import"./runtime-chunk-H7D3VFTJ.js";import"./runtime-chunk-XUM5HEC6.js";import"./runtime-chunk-ITLS6YIC.js";import"./runtime-chunk-AKWBEROQ.js";import{aa as n}from"./runtime-chunk-SXPM42HJ.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{b as h,e as m}from"./runtime-chunk-NWCLOXDY.js";import"./runtime-chunk-4KX4KQWR.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-R34HNX2O.js";import{a as c}from"./runtime-chunk-TZCHGFVF.js";import"./runtime-chunk-RBM3UDQF.js";import{Bc as p,Ec as d,Fc as l}from"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var u=(t,e)=>e.some(e=>e instanceof RegExp?e.test(t):e===t);var g=class{constructor({url:t,context:e},a,i,r){if(this.controlsManager=a,this.shared=i,this.condition=r,!t)throw new Error("Missing property");this.url=t.startsWith("mailto:")?t:function(t,e){if(e={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...e},t=t.trim(),/^data:/i.test(t))return((t,{stripHash:e})=>{let a=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(t);if(!a)throw new Error(`Invalid URL: ${t}`);let{type:i,data:r,hash:s}=a.groups,o=i.split(";");s=e?"":s;let n=!1;"base64"===o[o.length-1]&&(o.pop(),n=!0);let h=(o.shift()||"").toLowerCase(),m=[...o.map(t=>{let[e,a=""]=t.split("=").map(t=>t.trim());return"charset"===e&&(a=a.toLowerCase(),"us-ascii"===a)?"":`${e}${a?`=${a}`:""}`}).filter(Boolean)];return n&&m.push("base64"),(m.length>0||h&&"text/plain"!==h)&&m.unshift(h),`data:${m.join(";")},${n?r.trim():r}${s?`#${s}`:""}`})(t,e);if(/^view-source:/i.test(t))throw new Error("`view-source:` is not supported as it is a non-standard protocol");let a=t.startsWith("//");!a&&/^\.*\//.test(t)||(t=t.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));let i=new URL(t);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&"https:"===i.protocol&&(i.protocol="http:"),e.forceHttps&&"http:"===i.protocol&&(i.protocol="https:"),e.stripAuthentication&&(i.username="",i.password=""),e.stripHash?i.hash="":e.stripTextFragment&&(i.hash=i.hash.replace(/#?:~:text.*?$/i,"")),i.pathname){let t=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,e=0,a="";for(;;){let r=t.exec(i.pathname);if(!r)break;let s=r[0],o=r.index;a+=i.pathname.slice(e,o).replace(/\/{2,}/g,"/"),a+=s,e=o+s.length}a+=i.pathname.slice(e,i.pathname.length).replace(/\/{2,}/g,"/"),i.pathname=a}if(i.pathname)try{i.pathname=decodeURI(i.pathname)}catch{}if(!0===e.removeDirectoryIndex&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let t=i.pathname.split("/"),a=t[t.length-1];u(a,e.removeDirectoryIndex)&&(t=t.slice(0,-1),i.pathname=t.slice(1).join("/")+"/")}if(i.hostname&&(i.hostname=i.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(i.hostname)&&(i.hostname=i.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(let t of[...i.searchParams.keys()])u(t,e.removeQueryParameters)&&i.searchParams.delete(t);if(!0===e.removeQueryParameters&&(i.search=""),e.sortQueryParameters){i.searchParams.sort();try{i.search=decodeURIComponent(i.search)}catch{}}e.removeTrailingSlash&&(i.pathname=i.pathname.replace(/\/$/,""));let r=t;return t=i.toString(),!e.removeSingleSlash&&"/"===i.pathname&&!r.endsWith("/")&&""===i.hash&&(t=t.replace(/\/$/,"")),(e.removeTrailingSlash||"/"===i.pathname)&&""===i.hash&&e.removeSingleSlash&&(t=t.replace(/\/$/,"")),a&&!e.normalizeProtocol&&(t=t.replace(/^http:\/\//,"//")),e.stripProtocol&&(t=t.replace(/^(?:https?:)?\/\//,"")),t}(t,{removeTrailingSlash:!1,removeSingleSlash:!1,stripWWW:!1}),this.context=e??"tab"}dispatch(){if(!1===m(this.shared,this.condition))return!1;o?window.location.assign(this.url):("tab"===this.context||s&&"none"===this.context?window.open(this.url,"_blank"):"window"===this.context?window.open(this.url,"_blank",`width=${window.innerWidth}, height=${window.innerHeight}`):window.open(this.url,"_parent"),this.controlsManager.orbitControls?.onPointerUp(i[0]),r())}},w=class{constructor(t,e,a,i,r){this.data=t,this.page=e,this.shared=a,this.eventManager=i,this.condition=r}dispatch(){if(!1===m(this.shared,this.condition))return!1;clearTimeout(this.timeoutId),delete this.timeoutId,this.timeoutId=window.setTimeout(()=>{this.shared.reset(this.shared.data,!0),e(this.page,this.shared,!0),this.eventManager.reset(),this.eventManager.controlsManager.gameControl?.reset(!0),this.page.switchToPlayCamera(),this.eventManager.controlsManager.requestRender(),delete this.timeoutId},1e3*(this.data.delay??0))}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},f={type:"beginState"},v={type:"completeState",isfromEntity:!1},C={type:"requestRender"},y=class extends p{constructor(t,e,a,i){super(),this.data=t,this.page=e,this.shared=a,this.condition=i,this.toggleIsForward=!1,this.posStart=new l,this.posEnd=new l,this.qStart=new d,this.qEnd=new d,this.zoomStart=1,this.zoomEnd=1}init(){}get playing(){return this.animation&&this.animation.began&&!this.animation.completed}buildAnimation(e=!1){if(!this.data.animate)return;let i=this.page.scene.find(this.data.targetCamera);if(!i||!i.visible)throw new ReferenceError("Target camera not founded or not visible");let r={t:0};this.posStart.copy(this.page.activeCamera.position),this.qStart.copy(this.page.activeCamera.quaternion),this.zoomStart=this.page.activeCamera.zoom,this.animation=a({targets:r,t:1,...t(this.data),update:()=>{0===r.t&&("Toggle"!==this.data.runMode||this.toggleIsForward?(this.posEnd.copy(i.position),this.qEnd.copy(i.quaternion),this.zoomEnd=i.zoom,this.fromCamera=this.page.activeCamera,this.switchCamera(i.uuid)):this.fromCamera&&(this.posEnd.copy(this.fromCamera.position),this.qEnd.copy(this.fromCamera.quaternion),this.zoomEnd=this.fromCamera.zoom,this.switchCamera(this.fromCamera.uuid)),this.page.activeCamera.dispatchEvent(f));let t=this.page.activeCamera;t.position.lerpVectors(this.posStart,this.posEnd,r.t),t.quaternion.slerpQuaternions(this.qStart,this.qEnd,r.t),t.zoom=this.zoomStart+(this.zoomEnd-this.zoomStart)*r.t,t.wasMovedBySwitchCameraAction=!0,t.updateMatrix(),t.updateMatrixWorld(),t.updateProjectionMatrix(),t.dispatchEvent(C),1===r.t&&t.dispatchEvent(v)}})}switchCamera(t){let e=this.page.activeCamera,a=this.page.scene.find(t);if(!a||!a.visible)throw new ReferenceError("Target camera not founded or not visible");this.page.switchActiveCamera(a),e.dispatchEvent({type:"cameraChange",camera:a})}play(){if(!1===m(this.shared,this.condition))return!1;if(!this.playing&&this.page.activeCamera.uuid!==this.data.targetCamera)try{clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{delete this.timeoutId,this.data.animate?(this.buildAnimation(),this.animation?.play()):this.switchCamera(this.data.targetCamera)},1e3*this.data.delay)}catch{}}pause(){this.animation?.pause(),clearTimeout(this.timeoutId),delete this.timeoutId}toggle(t){if(!1===m(this.shared,this.condition))return!1;if(window.clearTimeout(this.timeoutId),delete this.timeoutId,t!==this.toggleIsForward)try{this.playing?(this.animation?.pause(),this.toggleIsForward=t??!this.toggleIsForward,this.buildAnimation(!0),this.animation?.play()):this.timeoutId=window.setTimeout(()=>{this.toggleIsForward=t??!this.toggleIsForward,this.data.animate?(this.animation?.pause(),this.buildAnimation(),this.animation?.play()):(this.toggleIsForward?(this.fromCamera=this.page.activeCamera,this.switchCamera(this.data.targetCamera)):this.fromCamera&&this.switchCamera(this.fromCamera.uuid),this.page.activeCamera.dispatchEvent(v),this.page.activeCamera.dispatchEvent(C))},1e3*this.data.delay)}catch{}}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause(),this.toggleIsForward=!1}},I=class{constructor(t,e,a,i){this.data=t,this.page=e,this.shared=a,this.condition=i}dispatch(){if(!1===m(this.shared,this.condition))return!1;("single"===this.data.target?this.data.variableId?[this.data.variableId]:[]:Object.keys(this.shared.getVariables())).forEach(t=>{this.shared.getVariable(t);let e=this.shared.data.variables.data(t)?.value;void 0!==e&&this.shared.updateVariable(t,e),this.shared.enableLocalStorageForPersistentVariables&&localStorage.removeItem(n(t))})}dispose(){}};h("Link",({data:t,eventManager:e,shared:a,actionCondition:i})=>new g(t,e.controlsManager,a,i)),h("Reset",({data:t,page:e,shared:a,eventManager:i,actionCondition:r})=>new w(t,e,a,i,r)),h("SwitchCamera",({data:t,page:e,shared:a,actionCondition:i})=>new y(t,e,a,i)),h("ClearLocalStorage",({data:t,page:e,shared:a,actionCondition:i})=>new I(t,e,a,i)),c("misc-actions");
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t,b as e,c as s,d as i}from"./runtime-chunk-
|
|
1
|
+
import{a as t,b as e,c as s,d as i}from"./runtime-chunk-CEAWQBAS.js";import"./runtime-chunk-KYA2CB5O.js";import{a as n}from"./runtime-chunk-NBYTQLIB.js";import{h as r}from"./runtime-chunk-4DNX5FPP.js";import"./runtime-chunk-GN3HDYV2.js";import"./runtime-chunk-XXRCB3ME.js";import"./runtime-chunk-TU4KDRKR.js";import{a as o,b as a}from"./runtime-chunk-DZNU62CT.js";import{a as h}from"./runtime-chunk-VAVYZ35B.js";import{e as c}from"./runtime-chunk-FQNSP44B.js";import"./runtime-chunk-H7D3VFTJ.js";import"./runtime-chunk-ITLS6YIC.js";import"./runtime-chunk-4E4NQ6GS.js";import"./runtime-chunk-AKWBEROQ.js";import"./runtime-chunk-SXPM42HJ.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{f as u,g as m}from"./runtime-chunk-NWCLOXDY.js";import"./runtime-chunk-4KX4KQWR.js";import{e as v,f as p}from"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-R34HNX2O.js";import{a as E}from"./runtime-chunk-TZCHGFVF.js";import"./runtime-chunk-RBM3UDQF.js";import"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var d=class{constructor(t,e,s,i,n,r){this.id=t,this.data=e,this.object=s,this.entered=!1,this.actions=u(e,e.actions,i,n,r,s)}disconnect(){m(this.actions)}dispatchEnter(){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.entered||(this.entered=!0,this.actions.TimelineAnimation.forEach(t=>t.playFromCurrent()),this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.play()),this.actions.Create.forEach(t=>t.dispatchStart()),this.actions.Particles.forEach(t=>t.dispatchBasic()),this.actions.Destroy.forEach(t=>t.dispatch()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent()),this.actions.SceneTransition.forEach(t=>t.dispatch()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}dispatchLeave(){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.entered&&(this.entered=!1,this.actions.TimelineAnimation.forEach(t=>t.reverseFromCurrent()),this.actions.Create.forEach(t=>t.dispatchStop()),this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Particles.forEach(t=>t.reverseFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.reverseFromCurrent()))}dispatchUserEvent(t){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),t?(this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Particles.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.reverseFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.playFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.playFromCurrent()),this.actions.Create.forEach(t=>t.dispatch()),this.actions.Particles.forEach(t=>t.dispatchBasic()),this.actions.Destroy.forEach(t=>t.dispatch()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent())),this.actions.SceneTransition.forEach(t=>t.dispatch()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}},f=class extends o{constructor(t,e){super(t),this.eventManager=e,this.eventsPerObjects={},this.objects=[],this.objects2D=[],this._prevObjects=[],this.onMouseDown=t=>{h.length>1||(this.eventContext.updateRaycaster(t),this.handleMouseHoverEvent())},this.onMouseUp=t=>{h.length>1||this.handleMouseHoverEvent(!0)},this.onMouseMove=t=>{h.length>1||(this.eventContext.updateRaycaster(t),this.handleMouseHoverEvent())},this.onUserEvent=({eventName:t,target:e,reverse:s})=>{if(!t||!e)return;let i=n(t);i&&"MouseHover"===i&&(e.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),this.eventsPerObjects[e.uuid]?.forEach(t=>t.dispatchUserEvent(s)))}}connect(){let{page:t,sharedAssets:e}=this.eventContext,s=(s,i)=>{if(s.visible&&s.data?.events.length){for(let{id:i,data:n}of s.data.events)if(!n.disabled&&"MouseHover"===n.type)try{let r=new d(i,n,s,t,e,this.eventManager);this.eventsPerObjects[s.uuid]?this.eventsPerObjects[s.uuid].push(r):this.eventsPerObjects[s.uuid]=[r]}catch(t){}this.eventsPerObjects[s.uuid]?.length&&this.objects.push(v(s)?i:s)}};if(t.traverseEntity(t=>{(p(t)||t instanceof r)&&t.frame?.traverse(e=>{s(e,t)}),s(t)}),!this.objects.length)return;let{domElement:i}=this.eventContext;this.domEventsNeeded.clear(),c&&(this.domEventsNeeded.add("pointerdown"),i.addEventListener("pointerdown",this.onMouseDown),this.domEventsNeeded.add("pointerup"),i.addEventListener("pointerup",this.onMouseUp)),this.domEventsNeeded.add("pointermove"),i.addEventListener("pointermove",this.onMouseMove),this.objects.forEach(t=>{t.addEventListener("userEvent",this.onUserEvent)})}disconnect(){if(!this.objects.length)return;let{domElement:t}=this.eventContext;this.domEventsNeeded.clear(),c&&(t.removeEventListener("pointerdown",this.onMouseDown),t.removeEventListener("pointerup",this.onMouseUp)),t.removeEventListener("pointermove",this.onMouseMove),Object.values(this.eventsPerObjects).forEach(t=>{t.forEach(t=>{t.disconnect()})}),this.objects.forEach(t=>{t.removeEventListener("userEvent",this.onUserEvent)})}handleMouseHoverEvent(n=!1){let r=[];if(!n){let{stopRaycast:n,raycaster:o,page:a,pointerScreen:h}=this.eventContext,c=!1;if(a.uiCanvas&&(c=s(a,[h.x,h.y],Object.keys(this.eventsPerObjects),t=>{r.push(t)})),n&&!c){let i=t(o,a,this.objects);r=e(i),i.forEach(t=>{p(t.object)&&s(t.object,[t?.uv?.x??0,t?.uv?.y??0],Object.keys(this.eventsPerObjects),t=>{r.push(t)})})}else this.objects.forEach(t=>{let e=i(o,t);e&&(r.push(t),p(t)&&s(t,[e?.uv?.x??0,e?.uv?.y??0],Object.keys(this.eventsPerObjects),t=>{r.push(t)}))})}this._prevObjects.length&&this._prevObjects.forEach(t=>{r.includes(t)||(t.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),this.eventsPerObjects[t.uuid]?.forEach(t=>t.dispatchLeave()))}),r.length&&r.forEach(t=>{t.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),this.eventsPerObjects[t.uuid]?.forEach(t=>t.dispatchEnter())}),this._prevObjects=r}};a("MouseHover",({eventContext:t,eventManager:e})=>new f(t,e)),E("mousehover");
|
|
Binary file
|
|
Binary file
|