@splinetool/runtime 2.0.6 → 2.0.8
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/hana-ui.js +44 -40
- package/build/hana-ui.js.br +0 -0
- package/build/hana-ui.js.gz +0 -0
- package/build/hana-ui.wasm +0 -0
- package/build/hana-ui.wasm.br +0 -0
- package/build/hana-ui.wasm.gz +0 -0
- package/build/{runtime-aiAssistant-KA7ZJ3F6.js → runtime-aiAssistant-KCI2YU3F.js} +1 -1
- package/build/runtime-aiAssistant-KCI2YU3F.js.br +0 -0
- package/build/runtime-aiAssistant-KCI2YU3F.js.gz +0 -0
- package/build/{runtime-apiServices-CGMAW2B4.js → runtime-apiServices-EYRJ5E55.js} +1 -1
- package/build/runtime-apiServices-EYRJ5E55.js.br +0 -0
- package/build/runtime-apiServices-EYRJ5E55.js.gz +0 -0
- package/build/{runtime-audio-GCUGVRQ3.js → runtime-audio-TEHDPDRZ.js} +1 -1
- package/build/runtime-audio-TEHDPDRZ.js.br +4 -0
- package/build/runtime-audio-TEHDPDRZ.js.gz +0 -0
- package/build/{runtime-chunk-HUFJRFTO.js → runtime-chunk-23QXG35G.js} +1 -1
- package/build/runtime-chunk-23QXG35G.js.br +0 -0
- package/build/runtime-chunk-23QXG35G.js.gz +0 -0
- package/build/{runtime-chunk-H7D3VFTJ.js → runtime-chunk-32KZP4YN.js} +1 -1
- package/build/runtime-chunk-32KZP4YN.js.br +0 -0
- package/build/runtime-chunk-32KZP4YN.js.gz +0 -0
- package/build/{runtime-chunk-MM2G3DLE.js → runtime-chunk-3GRN37GY.js} +1 -1
- package/build/runtime-chunk-3GRN37GY.js.br +0 -0
- package/build/runtime-chunk-3GRN37GY.js.gz +0 -0
- package/build/{runtime-chunk-LX3KCQF6.js → runtime-chunk-557KVSJL.js} +1 -1
- package/build/runtime-chunk-557KVSJL.js.br +0 -0
- package/build/runtime-chunk-557KVSJL.js.gz +0 -0
- package/build/{runtime-chunk-CX2MRLZA.js → runtime-chunk-5JEZ42OM.js} +1 -1
- package/build/runtime-chunk-5JEZ42OM.js.br +0 -0
- package/build/runtime-chunk-5JEZ42OM.js.gz +0 -0
- package/build/{runtime-chunk-KYA2CB5O.js → runtime-chunk-5RXW5MNJ.js} +1 -1
- package/build/runtime-chunk-5RXW5MNJ.js.br +0 -0
- package/build/runtime-chunk-5RXW5MNJ.js.gz +0 -0
- package/build/{runtime-chunk-AKWBEROQ.js → runtime-chunk-AELTGHV2.js} +1 -1
- package/build/runtime-chunk-AELTGHV2.js.br +0 -0
- package/build/runtime-chunk-AELTGHV2.js.gz +0 -0
- package/build/{runtime-chunk-NAJSQF6K.js → runtime-chunk-BMA5KYBS.js} +1 -1
- package/build/runtime-chunk-BMA5KYBS.js.br +0 -0
- package/build/runtime-chunk-BMA5KYBS.js.gz +0 -0
- package/build/{runtime-chunk-4KX4KQWR.js → runtime-chunk-CKT62HES.js} +1 -1
- package/build/runtime-chunk-CKT62HES.js.br +0 -0
- package/build/runtime-chunk-CKT62HES.js.gz +0 -0
- package/build/{runtime-chunk-CEAWQBAS.js → runtime-chunk-DHWGP6NU.js} +1 -1
- package/build/runtime-chunk-DHWGP6NU.js.br +0 -0
- package/build/runtime-chunk-DHWGP6NU.js.gz +0 -0
- package/build/{runtime-chunk-SXPM42HJ.js → runtime-chunk-DK66VKWP.js} +1 -1
- package/build/runtime-chunk-DK66VKWP.js.br +0 -0
- package/build/runtime-chunk-DK66VKWP.js.gz +0 -0
- package/build/{runtime-chunk-XUM5HEC6.js → runtime-chunk-E3IEBR27.js} +1 -1
- package/build/runtime-chunk-E3IEBR27.js.br +0 -0
- package/build/runtime-chunk-E3IEBR27.js.gz +0 -0
- package/build/{runtime-chunk-ITLS6YIC.js → runtime-chunk-EJJZJ5MV.js} +1 -1
- package/build/runtime-chunk-EJJZJ5MV.js.br +0 -0
- package/build/runtime-chunk-EJJZJ5MV.js.gz +0 -0
- package/build/{runtime-chunk-NWCLOXDY.js → runtime-chunk-EPHVY3XO.js} +1 -1
- package/build/runtime-chunk-EPHVY3XO.js.br +0 -0
- package/build/runtime-chunk-EPHVY3XO.js.gz +0 -0
- package/build/{runtime-chunk-GN3HDYV2.js → runtime-chunk-F3ZACLZW.js} +1 -1
- package/build/runtime-chunk-F3ZACLZW.js.br +0 -0
- package/build/runtime-chunk-F3ZACLZW.js.gz +0 -0
- package/build/{runtime-chunk-PUBEJSJO.js → runtime-chunk-GZ7C2GJM.js} +1 -1
- package/build/runtime-chunk-GZ7C2GJM.js.br +0 -0
- package/build/runtime-chunk-GZ7C2GJM.js.gz +0 -0
- package/build/{runtime-chunk-BPYFB4BD.js → runtime-chunk-HK23JJVH.js} +1 -1
- package/build/runtime-chunk-HK23JJVH.js.br +0 -0
- package/build/runtime-chunk-HK23JJVH.js.gz +0 -0
- package/build/{runtime-chunk-4DNX5FPP.js → runtime-chunk-HZ6FL5GH.js} +1 -1
- package/build/runtime-chunk-HZ6FL5GH.js.br +0 -0
- package/build/runtime-chunk-HZ6FL5GH.js.gz +0 -0
- package/build/{runtime-chunk-FY3XD5P2.js → runtime-chunk-KE6HNYUL.js} +1 -1
- package/build/runtime-chunk-KE6HNYUL.js.br +0 -0
- package/build/runtime-chunk-KE6HNYUL.js.gz +0 -0
- package/build/runtime-chunk-KNL33WN7.js +1 -0
- package/build/runtime-chunk-KNL33WN7.js.br +0 -0
- package/build/runtime-chunk-KNL33WN7.js.gz +0 -0
- package/build/runtime-chunk-OUXEWX5Z.js +1 -0
- package/build/runtime-chunk-OUXEWX5Z.js.br +0 -0
- package/build/runtime-chunk-OUXEWX5Z.js.gz +0 -0
- package/build/{runtime-chunk-RRXSRYPQ.js → runtime-chunk-PDASWDVC.js} +1 -1
- package/build/{runtime-chunk-RRXSRYPQ.js.br → runtime-chunk-PDASWDVC.js.br} +0 -0
- package/build/runtime-chunk-PDASWDVC.js.gz +0 -0
- package/build/{runtime-chunk-JQ3A6ENO.js → runtime-chunk-RLYG5YBB.js} +1 -1
- package/build/runtime-chunk-RLYG5YBB.js.br +1 -0
- package/build/runtime-chunk-RLYG5YBB.js.gz +0 -0
- package/build/{runtime-chunk-OF7IZ6BI.js → runtime-chunk-TAY7IXEZ.js} +1 -1
- package/build/runtime-chunk-TAY7IXEZ.js.br +0 -0
- package/build/runtime-chunk-TAY7IXEZ.js.gz +0 -0
- package/build/{runtime-chunk-R34HNX2O.js → runtime-chunk-U4QOT2PX.js} +1 -1
- package/build/runtime-chunk-U4QOT2PX.js.br +0 -0
- package/build/runtime-chunk-U4QOT2PX.js.gz +0 -0
- package/build/{runtime-chunk-GO25U5WN.js → runtime-chunk-UIM3XKIT.js} +1 -1
- package/build/runtime-chunk-UIM3XKIT.js.br +0 -0
- package/build/runtime-chunk-UIM3XKIT.js.gz +0 -0
- package/build/{runtime-chunk-4E4NQ6GS.js → runtime-chunk-USGQ26QU.js} +1 -1
- package/build/{runtime-chunk-4E4NQ6GS.js.br → runtime-chunk-USGQ26QU.js.br} +0 -0
- package/build/runtime-chunk-USGQ26QU.js.gz +0 -0
- package/build/{runtime-chunk-RBM3UDQF.js → runtime-chunk-VPEJ5BFD.js} +1 -1
- package/build/runtime-chunk-VPEJ5BFD.js.br +0 -0
- package/build/{runtime-chunk-RBM3UDQF.js.gz → runtime-chunk-VPEJ5BFD.js.gz} +0 -0
- package/build/{runtime-chunk-XXRCB3ME.js → runtime-chunk-YULW5JRE.js} +1 -1
- package/build/runtime-chunk-YULW5JRE.js.br +0 -0
- package/build/runtime-chunk-YULW5JRE.js.gz +0 -0
- package/build/{runtime-classicRuntime-PJ7JLKSY.js → runtime-classicRuntime-U672GAGM.js} +1 -1
- package/build/runtime-classicRuntime-U672GAGM.js.br +0 -0
- package/build/runtime-classicRuntime-U672GAGM.js.gz +0 -0
- package/build/runtime-cloners-2AC7OZRC.js +1 -0
- package/build/runtime-cloners-2AC7OZRC.js.br +0 -0
- package/build/runtime-cloners-2AC7OZRC.js.gz +0 -0
- package/build/{runtime-components-VRLLFORJ.js → runtime-components-L63NUGAO.js} +1 -1
- package/build/runtime-components-L63NUGAO.js.br +0 -0
- package/build/runtime-components-L63NUGAO.js.gz +0 -0
- package/build/{runtime-conditional-VA7AKA6O.js → runtime-conditional-HGOAXTBF.js} +1 -1
- package/build/runtime-conditional-HGOAXTBF.js.br +0 -0
- package/build/runtime-conditional-HGOAXTBF.js.gz +0 -0
- package/build/{runtime-createDestroy-IQVBLQ24.js → runtime-createDestroy-QHHQ6LYS.js} +1 -1
- package/build/runtime-createDestroy-QHHQ6LYS.js.br +0 -0
- package/build/runtime-createDestroy-QHHQ6LYS.js.gz +0 -0
- package/build/{runtime-dragDrop-XFI62H3C.js → runtime-dragDrop-YBSWK3ET.js} +1 -1
- package/build/runtime-dragDrop-YBSWK3ET.js.br +0 -0
- package/build/runtime-dragDrop-YBSWK3ET.js.gz +0 -0
- package/build/{runtime-gameControls-W3YS7OS2.js → runtime-gameControls-DSJRSTW5.js} +1 -1
- package/build/runtime-gameControls-DSJRSTW5.js.br +0 -0
- package/build/runtime-gameControls-DSJRSTW5.js.gz +0 -0
- package/build/runtime-hair-V4RTCES2.js +1 -0
- package/build/runtime-hair-V4RTCES2.js.br +2 -0
- package/build/runtime-hair-V4RTCES2.js.gz +0 -0
- package/build/{runtime-mergeStaticGeometries-KJFDZ7TP.js → runtime-mergeStaticGeometries-VXENKMD4.js} +1 -1
- package/build/runtime-mergeStaticGeometries-VXENKMD4.js.br +0 -0
- package/build/runtime-mergeStaticGeometries-VXENKMD4.js.gz +0 -0
- package/build/{runtime-miscActions-UGVVC2QC.js → runtime-miscActions-RPUPHHGJ.js} +1 -1
- package/build/runtime-miscActions-RPUPHHGJ.js.br +0 -0
- package/build/runtime-miscActions-RPUPHHGJ.js.gz +0 -0
- package/build/{runtime-mouseHover-O7Y26SM5.js → runtime-mouseHover-HG6AHA2L.js} +1 -1
- package/build/runtime-mouseHover-HG6AHA2L.js.br +0 -0
- package/build/runtime-mouseHover-HG6AHA2L.js.gz +0 -0
- package/build/{runtime-particles-GFRULQXO.js → runtime-particles-ZHE2MC33.js} +1 -1
- package/build/runtime-particles-ZHE2MC33.js.br +0 -0
- package/build/runtime-particles-ZHE2MC33.js.gz +0 -0
- package/build/{runtime-paths-Q7I56BAX.js → runtime-paths-GN6E6ZYL.js} +1 -1
- package/build/runtime-paths-GN6E6ZYL.js.br +0 -0
- package/build/runtime-paths-GN6E6ZYL.js.gz +0 -0
- package/build/{runtime-resize-2ZFLSK2M.js → runtime-resize-LACR4RFK.js} +1 -1
- package/build/runtime-resize-LACR4RFK.js.br +0 -0
- package/build/runtime-resize-LACR4RFK.js.gz +0 -0
- package/build/{runtime-sceneTransition-Z65VROHI.js → runtime-sceneTransition-QLPFYHHY.js} +1 -1
- package/build/runtime-sceneTransition-QLPFYHHY.js.br +0 -0
- package/build/runtime-sceneTransition-QLPFYHHY.js.gz +0 -0
- package/build/{runtime-scroll-NWKW6A6L.js → runtime-scroll-WZZBT2XR.js} +1 -1
- package/build/runtime-scroll-WZZBT2XR.js.br +0 -0
- package/build/runtime-scroll-WZZBT2XR.js.gz +0 -0
- package/build/runtime-shapeBlends-O6ATLCCA.js +1 -0
- package/build/runtime-shapeBlends-O6ATLCCA.js.br +0 -0
- package/build/runtime-shapeBlends-O6ATLCCA.js.gz +0 -0
- package/build/{runtime-text-VK3OGBSY.js → runtime-text-UADJSRL4.js} +1 -1
- package/build/runtime-text-UADJSRL4.js.br +0 -0
- package/build/runtime-text-UADJSRL4.js.gz +0 -0
- package/build/{runtime-textInputs-JJQSKO3C.js → runtime-textInputs-7U3TTJ4X.js} +1 -1
- package/build/runtime-textInputs-7U3TTJ4X.js.br +0 -0
- package/build/runtime-textInputs-7U3TTJ4X.js.gz +0 -0
- package/build/runtime-timeline-JXKHKUAC.js +1 -0
- package/build/runtime-timeline-JXKHKUAC.js.br +0 -0
- package/build/runtime-timeline-JXKHKUAC.js.gz +0 -0
- package/build/{runtime-tracking-KYP5WOMH.js → runtime-tracking-MC74576T.js} +1 -1
- package/build/runtime-tracking-MC74576T.js.br +0 -0
- package/build/runtime-tracking-MC74576T.js.gz +0 -0
- package/build/{runtime-transitions-FDRKYMVP.js → runtime-transitions-S22YS7E6.js} +1 -1
- package/build/runtime-transitions-S22YS7E6.js.br +0 -0
- package/build/runtime-transitions-S22YS7E6.js.gz +0 -0
- package/build/{runtime-ui2d-YO6M74VQ.js → runtime-ui2d-EX3RBXPP.js} +1 -1
- package/build/runtime-ui2d-EX3RBXPP.js.br +0 -0
- package/build/runtime-ui2d-EX3RBXPP.js.gz +0 -0
- package/build/{runtime-updater-FS5YHXO4.js → runtime-updater-GOXAMNAK.js} +1 -1
- package/build/runtime-updater-GOXAMNAK.js.br +5 -0
- package/build/runtime-updater-GOXAMNAK.js.gz +0 -0
- package/build/{runtime-variables-CYDDC6HF.js → runtime-variables-36KLHNE5.js} +1 -1
- package/build/runtime-variables-36KLHNE5.js.br +0 -0
- package/build/runtime-variables-36KLHNE5.js.gz +0 -0
- package/build/{runtime-vectorShapes-VMDJ36X2.js → runtime-vectorShapes-J5Y3LMND.js} +1 -1
- package/build/runtime-vectorShapes-J5Y3LMND.js.br +0 -0
- package/build/runtime-vectorShapes-J5Y3LMND.js.gz +0 -0
- package/build/{runtime-video-MTXK33PT.js → runtime-video-XIULR4BY.js} +1 -1
- package/build/runtime-video-XIULR4BY.js.br +0 -0
- package/build/runtime-video-XIULR4BY.js.gz +0 -0
- package/build/runtime-webgpu-LDZ3N2D5.js +1 -0
- package/build/runtime-webgpu-LDZ3N2D5.js.br +0 -0
- package/build/runtime-webgpu-LDZ3N2D5.js.gz +0 -0
- package/build/runtime.cjs +102 -102
- package/build/runtime.js +1 -1
- package/build/runtime.js.br +0 -0
- package/build/runtime.js.gz +0 -0
- package/build/runtime.standalone.js +1 -1
- package/build/runtime.standalone.js.br +0 -0
- package/build/runtime.standalone.js.gz +0 -0
- package/build/runtime.standalone.webgl.js +1 -1
- package/build/runtime.standalone.webgl.js.br +0 -0
- package/build/runtime.standalone.webgl.js.gz +0 -0
- package/build/runtime.standalone.webgpu.js +1 -1
- package/build/runtime.standalone.webgpu.js.br +0 -0
- package/build/runtime.standalone.webgpu.js.gz +0 -0
- package/build/runtime.standalone.webgpu.micro.js +1 -1
- package/build/runtime.standalone.webgpu.micro.js.br +0 -0
- package/build/runtime.standalone.webgpu.micro.js.gz +0 -0
- package/build/runtime.standalone.webgpu.min.js +1 -1
- package/build/runtime.standalone.webgpu.min.js.br +0 -0
- package/build/runtime.standalone.webgpu.min.js.gz +0 -0
- package/package.json +1 -1
- package/build/runtime-aiAssistant-KA7ZJ3F6.js.br +0 -0
- package/build/runtime-aiAssistant-KA7ZJ3F6.js.gz +0 -0
- package/build/runtime-apiServices-CGMAW2B4.js.br +0 -0
- package/build/runtime-apiServices-CGMAW2B4.js.gz +0 -0
- package/build/runtime-audio-GCUGVRQ3.js.br +0 -0
- package/build/runtime-audio-GCUGVRQ3.js.gz +0 -0
- package/build/runtime-chunk-3KIZF7P5.js +0 -1
- package/build/runtime-chunk-3KIZF7P5.js.br +0 -0
- package/build/runtime-chunk-3KIZF7P5.js.gz +0 -0
- package/build/runtime-chunk-4DNX5FPP.js.br +0 -0
- package/build/runtime-chunk-4DNX5FPP.js.gz +0 -0
- package/build/runtime-chunk-4E4NQ6GS.js.gz +0 -0
- package/build/runtime-chunk-4KX4KQWR.js.br +0 -0
- package/build/runtime-chunk-4KX4KQWR.js.gz +0 -0
- package/build/runtime-chunk-AKWBEROQ.js.br +0 -0
- package/build/runtime-chunk-AKWBEROQ.js.gz +0 -0
- package/build/runtime-chunk-BPYFB4BD.js.br +0 -0
- package/build/runtime-chunk-BPYFB4BD.js.gz +0 -0
- package/build/runtime-chunk-CCJD7IX7.js +0 -1
- package/build/runtime-chunk-CCJD7IX7.js.br +0 -0
- package/build/runtime-chunk-CCJD7IX7.js.gz +0 -0
- package/build/runtime-chunk-CEAWQBAS.js.br +0 -0
- package/build/runtime-chunk-CEAWQBAS.js.gz +0 -0
- package/build/runtime-chunk-CX2MRLZA.js.br +0 -0
- package/build/runtime-chunk-CX2MRLZA.js.gz +0 -0
- package/build/runtime-chunk-FY3XD5P2.js.br +0 -0
- package/build/runtime-chunk-FY3XD5P2.js.gz +0 -0
- package/build/runtime-chunk-GN3HDYV2.js.br +0 -0
- package/build/runtime-chunk-GN3HDYV2.js.gz +0 -0
- package/build/runtime-chunk-GO25U5WN.js.br +0 -0
- package/build/runtime-chunk-GO25U5WN.js.gz +0 -0
- package/build/runtime-chunk-H7D3VFTJ.js.br +0 -0
- package/build/runtime-chunk-H7D3VFTJ.js.gz +0 -0
- package/build/runtime-chunk-HUFJRFTO.js.br +0 -0
- package/build/runtime-chunk-HUFJRFTO.js.gz +0 -0
- package/build/runtime-chunk-ITLS6YIC.js.br +0 -0
- package/build/runtime-chunk-ITLS6YIC.js.gz +0 -0
- package/build/runtime-chunk-JQ3A6ENO.js.br +0 -1
- package/build/runtime-chunk-JQ3A6ENO.js.gz +0 -0
- package/build/runtime-chunk-KYA2CB5O.js.br +0 -0
- package/build/runtime-chunk-KYA2CB5O.js.gz +0 -0
- package/build/runtime-chunk-LX3KCQF6.js.br +0 -0
- package/build/runtime-chunk-LX3KCQF6.js.gz +0 -0
- package/build/runtime-chunk-MM2G3DLE.js.br +0 -0
- package/build/runtime-chunk-MM2G3DLE.js.gz +0 -0
- package/build/runtime-chunk-NAJSQF6K.js.br +0 -0
- package/build/runtime-chunk-NAJSQF6K.js.gz +0 -0
- package/build/runtime-chunk-NWCLOXDY.js.br +0 -0
- package/build/runtime-chunk-NWCLOXDY.js.gz +0 -0
- package/build/runtime-chunk-OF7IZ6BI.js.br +0 -0
- package/build/runtime-chunk-OF7IZ6BI.js.gz +0 -0
- package/build/runtime-chunk-PUBEJSJO.js.br +0 -0
- package/build/runtime-chunk-PUBEJSJO.js.gz +0 -0
- package/build/runtime-chunk-R34HNX2O.js.br +0 -0
- package/build/runtime-chunk-R34HNX2O.js.gz +0 -0
- package/build/runtime-chunk-RBM3UDQF.js.br +0 -0
- package/build/runtime-chunk-RRXSRYPQ.js.gz +0 -0
- package/build/runtime-chunk-SXPM42HJ.js.br +0 -0
- package/build/runtime-chunk-SXPM42HJ.js.gz +0 -0
- package/build/runtime-chunk-XUM5HEC6.js.br +0 -0
- package/build/runtime-chunk-XUM5HEC6.js.gz +0 -0
- package/build/runtime-chunk-XXRCB3ME.js.br +0 -0
- package/build/runtime-chunk-XXRCB3ME.js.gz +0 -0
- package/build/runtime-classicRuntime-PJ7JLKSY.js.br +0 -0
- package/build/runtime-classicRuntime-PJ7JLKSY.js.gz +0 -0
- package/build/runtime-cloners-SM2IKR3Q.js +0 -1
- package/build/runtime-cloners-SM2IKR3Q.js.br +0 -3
- package/build/runtime-cloners-SM2IKR3Q.js.gz +0 -0
- package/build/runtime-components-VRLLFORJ.js.br +0 -0
- package/build/runtime-components-VRLLFORJ.js.gz +0 -0
- package/build/runtime-conditional-VA7AKA6O.js.br +0 -0
- package/build/runtime-conditional-VA7AKA6O.js.gz +0 -0
- package/build/runtime-createDestroy-IQVBLQ24.js.br +0 -0
- package/build/runtime-createDestroy-IQVBLQ24.js.gz +0 -0
- package/build/runtime-dragDrop-XFI62H3C.js.br +0 -0
- package/build/runtime-dragDrop-XFI62H3C.js.gz +0 -0
- package/build/runtime-gameControls-W3YS7OS2.js.br +0 -0
- package/build/runtime-gameControls-W3YS7OS2.js.gz +0 -0
- package/build/runtime-hair-CWPDHNZF.js +0 -1
- package/build/runtime-hair-CWPDHNZF.js.br +0 -1
- package/build/runtime-hair-CWPDHNZF.js.gz +0 -0
- package/build/runtime-mergeStaticGeometries-KJFDZ7TP.js.br +0 -0
- package/build/runtime-mergeStaticGeometries-KJFDZ7TP.js.gz +0 -0
- package/build/runtime-miscActions-UGVVC2QC.js.br +0 -0
- package/build/runtime-miscActions-UGVVC2QC.js.gz +0 -0
- package/build/runtime-mouseHover-O7Y26SM5.js.br +0 -0
- package/build/runtime-mouseHover-O7Y26SM5.js.gz +0 -0
- package/build/runtime-particles-GFRULQXO.js.br +0 -0
- package/build/runtime-particles-GFRULQXO.js.gz +0 -0
- package/build/runtime-paths-Q7I56BAX.js.br +0 -0
- package/build/runtime-paths-Q7I56BAX.js.gz +0 -0
- package/build/runtime-resize-2ZFLSK2M.js.br +0 -0
- package/build/runtime-resize-2ZFLSK2M.js.gz +0 -0
- package/build/runtime-sceneTransition-Z65VROHI.js.br +0 -0
- package/build/runtime-sceneTransition-Z65VROHI.js.gz +0 -0
- package/build/runtime-scroll-NWKW6A6L.js.br +0 -0
- package/build/runtime-scroll-NWKW6A6L.js.gz +0 -0
- package/build/runtime-shapeBlends-QB7JKEHC.js +0 -1
- package/build/runtime-shapeBlends-QB7JKEHC.js.br +0 -5
- package/build/runtime-shapeBlends-QB7JKEHC.js.gz +0 -0
- package/build/runtime-text-VK3OGBSY.js.br +0 -0
- package/build/runtime-text-VK3OGBSY.js.gz +0 -0
- package/build/runtime-textInputs-JJQSKO3C.js.br +0 -0
- package/build/runtime-textInputs-JJQSKO3C.js.gz +0 -0
- package/build/runtime-timeline-WRAEBCRZ.js +0 -1
- package/build/runtime-timeline-WRAEBCRZ.js.br +0 -0
- package/build/runtime-timeline-WRAEBCRZ.js.gz +0 -0
- package/build/runtime-tracking-KYP5WOMH.js.br +0 -0
- package/build/runtime-tracking-KYP5WOMH.js.gz +0 -0
- package/build/runtime-transitions-FDRKYMVP.js.br +0 -0
- package/build/runtime-transitions-FDRKYMVP.js.gz +0 -0
- package/build/runtime-ui2d-YO6M74VQ.js.br +0 -0
- package/build/runtime-ui2d-YO6M74VQ.js.gz +0 -0
- package/build/runtime-updater-FS5YHXO4.js.br +0 -1
- package/build/runtime-updater-FS5YHXO4.js.gz +0 -0
- package/build/runtime-variables-CYDDC6HF.js.br +0 -0
- package/build/runtime-variables-CYDDC6HF.js.gz +0 -0
- package/build/runtime-vectorShapes-VMDJ36X2.js.br +0 -0
- package/build/runtime-vectorShapes-VMDJ36X2.js.gz +0 -0
- package/build/runtime-video-MTXK33PT.js.br +0 -0
- package/build/runtime-video-MTXK33PT.js.gz +0 -0
- package/build/runtime-webgpu-WDY6L7BV.js +0 -1
- package/build/runtime-webgpu-WDY6L7BV.js.br +0 -0
- package/build/runtime-webgpu-WDY6L7BV.js.gz +0 -0
package/build/hana-ui.js
CHANGED
|
@@ -2002,6 +2002,10 @@ function __wbg_get_imports() {
|
|
|
2002
2002
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
2003
2003
|
return addHeapObject(ret);
|
|
2004
2004
|
}, arguments); },
|
|
2005
|
+
__wbg_get_index_ab123d64c89e3156: function(arg0, arg1) {
|
|
2006
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
2007
|
+
return ret;
|
|
2008
|
+
},
|
|
2005
2009
|
__wbg_get_unchecked_33f6e5c9e2f2d6b2: function(arg0, arg1) {
|
|
2006
2010
|
const ret = getObject(arg0)[arg1 >>> 0];
|
|
2007
2011
|
return addHeapObject(ret);
|
|
@@ -2406,7 +2410,7 @@ function __wbg_get_imports() {
|
|
|
2406
2410
|
const a = state0.a;
|
|
2407
2411
|
state0.a = 0;
|
|
2408
2412
|
try {
|
|
2409
|
-
return
|
|
2413
|
+
return __wasm_bindgen_func_elem_14112(a, state0.b, arg0, arg1);
|
|
2410
2414
|
} finally {
|
|
2411
2415
|
state0.a = a;
|
|
2412
2416
|
}
|
|
@@ -2452,7 +2456,7 @@ function __wbg_get_imports() {
|
|
|
2452
2456
|
const a = state0.a;
|
|
2453
2457
|
state0.a = 0;
|
|
2454
2458
|
try {
|
|
2455
|
-
return
|
|
2459
|
+
return __wasm_bindgen_func_elem_14112(a, state0.b, arg0, arg1);
|
|
2456
2460
|
} finally {
|
|
2457
2461
|
state0.a = a;
|
|
2458
2462
|
}
|
|
@@ -3552,48 +3556,48 @@ function __wbg_get_imports() {
|
|
|
3552
3556
|
getObject(arg0).writeTexture(getObject(arg1), getArrayU8FromWasm0(arg2, arg3), getObject(arg4), getObject(arg5));
|
|
3553
3557
|
}, arguments); },
|
|
3554
3558
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
3555
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3556
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3559
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1052, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3560
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_14110);
|
|
3557
3561
|
return addHeapObject(ret);
|
|
3558
3562
|
},
|
|
3559
3563
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
3560
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx:
|
|
3561
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3564
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 32, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3565
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_5086);
|
|
3562
3566
|
return addHeapObject(ret);
|
|
3563
3567
|
},
|
|
3564
3568
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
3565
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUComputePipeline")], shim_idx:
|
|
3566
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3569
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUComputePipeline")], shim_idx: 927, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3570
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11070);
|
|
3567
3571
|
return addHeapObject(ret);
|
|
3568
3572
|
},
|
|
3569
3573
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
3570
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx:
|
|
3571
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3574
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 927, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3575
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11070_3);
|
|
3572
3576
|
return addHeapObject(ret);
|
|
3573
3577
|
},
|
|
3574
3578
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
3575
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx:
|
|
3576
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3579
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 928, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3580
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11071);
|
|
3577
3581
|
return addHeapObject(ret);
|
|
3578
3582
|
},
|
|
3579
3583
|
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
3580
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPURenderPipeline")], shim_idx:
|
|
3581
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3584
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPURenderPipeline")], shim_idx: 927, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3585
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11070_5);
|
|
3582
3586
|
return addHeapObject(ret);
|
|
3583
3587
|
},
|
|
3584
3588
|
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
|
|
3585
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx:
|
|
3586
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3589
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 927, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3590
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11070_6);
|
|
3587
3591
|
return addHeapObject(ret);
|
|
3588
3592
|
},
|
|
3589
3593
|
__wbindgen_cast_0000000000000008: function(arg0, arg1) {
|
|
3590
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx:
|
|
3591
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3594
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 927, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3595
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11070_7);
|
|
3592
3596
|
return addHeapObject(ret);
|
|
3593
3597
|
},
|
|
3594
3598
|
__wbindgen_cast_0000000000000009: function(arg0, arg1) {
|
|
3595
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
3596
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3599
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1035, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3600
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_12477);
|
|
3597
3601
|
return addHeapObject(ret);
|
|
3598
3602
|
},
|
|
3599
3603
|
__wbindgen_cast_000000000000000a: function(arg0) {
|
|
@@ -3667,22 +3671,22 @@ function __wbg_get_imports() {
|
|
|
3667
3671
|
};
|
|
3668
3672
|
}
|
|
3669
3673
|
|
|
3670
|
-
function
|
|
3671
|
-
wasm.
|
|
3674
|
+
function __wasm_bindgen_func_elem_12477(arg0, arg1) {
|
|
3675
|
+
wasm.__wasm_bindgen_func_elem_12477(arg0, arg1);
|
|
3672
3676
|
}
|
|
3673
3677
|
|
|
3674
|
-
function
|
|
3675
|
-
wasm.
|
|
3678
|
+
function __wasm_bindgen_func_elem_5086(arg0, arg1, arg2) {
|
|
3679
|
+
wasm.__wasm_bindgen_func_elem_5086(arg0, arg1, addHeapObject(arg2));
|
|
3676
3680
|
}
|
|
3677
3681
|
|
|
3678
|
-
function
|
|
3679
|
-
wasm.
|
|
3682
|
+
function __wasm_bindgen_func_elem_11071(arg0, arg1, arg2) {
|
|
3683
|
+
wasm.__wasm_bindgen_func_elem_11071(arg0, arg1, addHeapObject(arg2));
|
|
3680
3684
|
}
|
|
3681
3685
|
|
|
3682
|
-
function
|
|
3686
|
+
function __wasm_bindgen_func_elem_14110(arg0, arg1, arg2) {
|
|
3683
3687
|
try {
|
|
3684
3688
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3685
|
-
wasm.
|
|
3689
|
+
wasm.__wasm_bindgen_func_elem_14110(retptr, arg0, arg1, addHeapObject(arg2));
|
|
3686
3690
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3687
3691
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3688
3692
|
if (r1) {
|
|
@@ -3693,10 +3697,10 @@ function __wasm_bindgen_func_elem_12877(arg0, arg1, arg2) {
|
|
|
3693
3697
|
}
|
|
3694
3698
|
}
|
|
3695
3699
|
|
|
3696
|
-
function
|
|
3700
|
+
function __wasm_bindgen_func_elem_11070(arg0, arg1, arg2) {
|
|
3697
3701
|
try {
|
|
3698
3702
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3699
|
-
wasm.
|
|
3703
|
+
wasm.__wasm_bindgen_func_elem_11070(retptr, arg0, arg1, addHeapObject(arg2));
|
|
3700
3704
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3701
3705
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3702
3706
|
if (r1) {
|
|
@@ -3707,10 +3711,10 @@ function __wasm_bindgen_func_elem_9853(arg0, arg1, arg2) {
|
|
|
3707
3711
|
}
|
|
3708
3712
|
}
|
|
3709
3713
|
|
|
3710
|
-
function
|
|
3714
|
+
function __wasm_bindgen_func_elem_11070_3(arg0, arg1, arg2) {
|
|
3711
3715
|
try {
|
|
3712
3716
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3713
|
-
wasm.
|
|
3717
|
+
wasm.__wasm_bindgen_func_elem_11070_3(retptr, arg0, arg1, addHeapObject(arg2));
|
|
3714
3718
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3715
3719
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3716
3720
|
if (r1) {
|
|
@@ -3721,10 +3725,10 @@ function __wasm_bindgen_func_elem_9853_3(arg0, arg1, arg2) {
|
|
|
3721
3725
|
}
|
|
3722
3726
|
}
|
|
3723
3727
|
|
|
3724
|
-
function
|
|
3728
|
+
function __wasm_bindgen_func_elem_11070_5(arg0, arg1, arg2) {
|
|
3725
3729
|
try {
|
|
3726
3730
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3727
|
-
wasm.
|
|
3731
|
+
wasm.__wasm_bindgen_func_elem_11070_5(retptr, arg0, arg1, addHeapObject(arg2));
|
|
3728
3732
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3729
3733
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3730
3734
|
if (r1) {
|
|
@@ -3735,10 +3739,10 @@ function __wasm_bindgen_func_elem_9853_5(arg0, arg1, arg2) {
|
|
|
3735
3739
|
}
|
|
3736
3740
|
}
|
|
3737
3741
|
|
|
3738
|
-
function
|
|
3742
|
+
function __wasm_bindgen_func_elem_11070_6(arg0, arg1, arg2) {
|
|
3739
3743
|
try {
|
|
3740
3744
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3741
|
-
wasm.
|
|
3745
|
+
wasm.__wasm_bindgen_func_elem_11070_6(retptr, arg0, arg1, addHeapObject(arg2));
|
|
3742
3746
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3743
3747
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3744
3748
|
if (r1) {
|
|
@@ -3749,10 +3753,10 @@ function __wasm_bindgen_func_elem_9853_6(arg0, arg1, arg2) {
|
|
|
3749
3753
|
}
|
|
3750
3754
|
}
|
|
3751
3755
|
|
|
3752
|
-
function
|
|
3756
|
+
function __wasm_bindgen_func_elem_11070_7(arg0, arg1, arg2) {
|
|
3753
3757
|
try {
|
|
3754
3758
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3755
|
-
wasm.
|
|
3759
|
+
wasm.__wasm_bindgen_func_elem_11070_7(retptr, arg0, arg1, addHeapObject(arg2));
|
|
3756
3760
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3757
3761
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3758
3762
|
if (r1) {
|
|
@@ -3763,8 +3767,8 @@ function __wasm_bindgen_func_elem_9853_7(arg0, arg1, arg2) {
|
|
|
3763
3767
|
}
|
|
3764
3768
|
}
|
|
3765
3769
|
|
|
3766
|
-
function
|
|
3767
|
-
wasm.
|
|
3770
|
+
function __wasm_bindgen_func_elem_14112(arg0, arg1, arg2, arg3) {
|
|
3771
|
+
wasm.__wasm_bindgen_func_elem_14112(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
3768
3772
|
}
|
|
3769
3773
|
|
|
3770
3774
|
|
package/build/hana-ui.js.br
CHANGED
|
Binary file
|
package/build/hana-ui.js.gz
CHANGED
|
Binary file
|
package/build/hana-ui.wasm
CHANGED
|
Binary file
|
package/build/hana-ui.wasm.br
CHANGED
|
Binary file
|
package/build/hana-ui.wasm.gz
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./runtime-chunk-NTUTXO7Q.js";import{a as t,b as s}from"./runtime-chunk-DZNU62CT.js";import{c as i}from"./runtime-chunk-4YV3EXSU.js";import{f as a}from"./runtime-chunk-NWCLOXDY.js";import"./runtime-chunk-R34HNX2O.js";import{a as n}from"./runtime-chunk-TZCHGFVF.js";import"./runtime-chunk-RBM3UDQF.js";import"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var r=class extends t{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.onVoice=({value:e,frequencies:t})=>{this.events.forEach(e=>{e.dispatch()})}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"AIAssistantListener"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new o(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("voice",this.onVoice))}disconnect(){this.openAIRealtime?.off("voice",this.onVoice)}},o=class{constructor(e,t,s,i,n,r){this.id=e,this.data=t,this.object=s,this.actions=a(t,t.actions,i,n,r,s)}dispatch(){this.dispatchActions(this.actions)}dispatchActions(e){e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}},c=class extends t{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.onTriggerEvent=({description:e,direction:t})=>{let s=this.events.find(t=>t.data.description===e);s&&("backward"===t?s.dispatchReverse():s.dispatch())}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"AIAssistantTrigger"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new h(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("trigger_event",this.onTriggerEvent))}disconnect(){this.openAIRealtime?.off("trigger_event",this.onTriggerEvent)}},h=class{constructor(e,t,s,i,n,r){this.id=e,this.data=t,this.object=s,this.actions=a(t,t.actions,i,n,r,s)}dispatch(){let e=this.actions;e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}dispatchReverse(){let e=this.actions;e.Transition.forEach(e=>e.reverseFromCurrent()),e.Particles.forEach(e=>e.reverseFromCurrent()),e.Animation.forEach(e=>e.reverseFromCurrent()),e.SwitchCamera.forEach(e=>e.reverseFromCurrent()),e.Create.forEach(e=>e.dispatchStop())}},l=function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(e,t,s,i)=>String(t+t+s+s+i+i));let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},d=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],p=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],u=[],f=[];for(let e=1;e<=8;e++)for(let t=0;t<d.length;t++){let s=d[t];u.push(s/Math.pow(2,8-e)),f.push(p[t]+e)}var v=[32,2e3],m=u.filter((e,t)=>u[t]>v[0]&&u[t]<v[1]),y=f.filter((e,t)=>u[t]>v[0]&&u[t]<v[1]),g=class{static getFrequencies(e,t,s,i="frequency",a=-100,n=-30){s||(s=new Float32Array(e.frequencyBinCount),e.getFloatFrequencyData(s));let r,o,c,h=t/2,l=1/s.length*h;if("music"===i||"voice"===i){let e="voice"===i?m:u,t=Array(e.length).fill(a);for(let i=0;i<s.length;i++){let a=i*l,n=s[i];for(let s=e.length-1;s>=0;s--)if(a>e[s]){t[s]=Math.max(t[s],n);break}}r=t,o="voice"===i?m:u,c="voice"===i?y:f}else r=Array.from(s),o=r.map((e,t)=>l*t),c=o.map(e=>`${e.toFixed(2)} Hz`);let d=r.map(e=>Math.max(0,Math.min((e-a)/(n-a),1)));return{values:new Float32Array(d),frequencies:o,labels:c}}},E=class{constructor(e){this.value=0,this.frequencies=new Float32Array(0);let t=new AudioContext;this.source=t.createMediaStreamSource(e),this.analyser=t.createAnalyser(),this.source.connect(this.analyser),this.analyser.fftSize=8192,this.analyser.smoothingTimeConstant=.1}getFrequencies(e=-100,t=-30){if(!this.analyser)throw new Error("Not connected, please call .connect() first");return g.getFrequencies(this.analyser,44100,void 0,"voice",e,t)}update(){let e=this.getFrequencies(),t=e.values.reduce((e,t)=>e+t,0)/e.values.length;this.value=t,this.frequencies=e.values}disconnect(){this.source.disconnect(),this.analyser.disconnect()}},b=class{constructor(e){this.callbacks=e,this.rafId=0,this.isOpen=!1,this.onMessage=e=>{this.callbacks.onMessage(e.data)},this.onOpen=()=>{this.isOpen=!0,this.callbacks.onOpen()},this.animate=()=>{this.rafId=requestAnimationFrame(this.animate),this.isOpen&&this.analyser&&(this.analyser.update(),this.callbacks.onVoice(this.analyser.value,this.analyser.frequencies))}}async connect(e){let t=await async function(e){try{return(await(await fetch("https://relayserver.spline.design/session?uuidfile="+e)).json()).token}catch(e){console.error("Token generation error:",e)}}(e);this.pc=new RTCPeerConnection,this.audioElement=document.createElement("audio"),this.audioElement.autoplay=!0,this.pc.ontrack=e=>{let t=e.streams[0];this.audioElement.srcObject=t,this.analyser=new E(t)};let s=await navigator.mediaDevices.getUserMedia({audio:!0});this.pc.addTrack(s.getTracks()[0]),this.dc=this.pc.createDataChannel("oai-events"),this.dc.addEventListener("message",this.onMessage),this.dc.addEventListener("open",this.onOpen);let i=await this.pc.createOffer();await this.pc.setLocalDescription(i);let a={type:"answer",sdp:await(await fetch("https://api.openai.com/v1/realtime/calls?model=gpt-realtime",{method:"POST",body:i.sdp,headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/sdp"}})).text()};await this.pc.setRemoteDescription(a),this.animate()}send(e){return!!this.dc&&(this.dc.send(e),!0)}disconnect(){cancelAnimationFrame(this.rafId),this.analyser?.disconnect(),this.isOpen=!1,this.dc?.removeEventListener("message",this.onMessage),this.dc?.removeEventListener("open",this.onOpen),this.dc?.close(),this.pc?.getSenders().forEach(e=>{e.track&&e.track.stop()}),this.pc?.close(),this.pc=void 0}};var w=class{constructor(t,s,i){this.data=t,this.id=s,this.shared=i,this.emitter=e(),this.voice=0,this.frequencies=new Float32Array([0]),this.events=[],this.isConnected=!1,this.isToolsAdded=!1,this.tools=[],this.onServerEvent=e=>{let t=JSON.parse(e);if(this.appendEvent(t),"session.created"===t.type&&this.onSessionCreated(),"response.done"===t.type&&t.response?.output)for(let e of t.response.output)if("function_call"===e.type)for(let[t,s]of this.tools)e.name===t.name&&(s(JSON.parse(e.arguments)),setTimeout(()=>{this.sendClientEvent({type:"response.create",response:{instructions:"notice the user about what you just did"}})}))},this.onSessionCreated=()=>{this.isToolsAdded||this.registerTools()},this.onOpen=()=>{this.events=[],this.isConnected=!0,this.sendClientEvent({type:"response.create",response:{instructions:"Say hi"}})}}update(e){this.data=e}setColorByName(e,t){let s=this.shared.getColorByName(e);if(s){let{id:e}=s,{r:i,g:a,b:n}=l(t)??{r:0,g:0,b:0};this.shared.updateColor(e,{r:i/255,g:a/255,b:n/255})}}async connect(){if(this.isConnected||this.session||this.hosted)return;let e={onMessage:this.onServerEvent,onOpen:this.onOpen,onVoice:(e,t)=>{this.voice=e,this.frequencies=t,this.emitter.emit("voice",{value:e,frequencies:t})}};this.hosted=function(e,t,s){if(!function(){try{return!0===window.__SPLINE_PLAY_VOICE_HOST__&&window.parent!==window}catch{return!1}}())return null;let i=!1,a=e=>{window.parent.postMessage({__splinePlayFrame:!0,...e},"*")},n=t=>{if(t.source!==window.parent)return;let a=t.data;!a||!0!==a.__splinePlayFrameHost||a.id!==e||("voice-open"===a.type?(i=!0,s.onOpen()):"voice-message"===a.type&&"string"==typeof a.data?s.onMessage(a.data):"voice-level"===a.type&&"number"==typeof a.value?s.onVoice(a.value,a.frequencies instanceof Float32Array?a.frequencies:new Float32Array(0)):"voice-error"===a.type&&console.error("Voice assistant host error:",a.message))};return window.addEventListener("message",n),a({type:"voice-connect",id:e,hash:t}),{send:t=>!!i&&(a({type:"voice-send",id:e,message:t}),!0),disconnect:()=>{i=!1,window.removeEventListener("message",n),a({type:"voice-disconnect",id:e})}}}(this.id,this.data.integration.hash,e),!this.hosted&&(this.session=new b(e),await this.session.connect(this.data.integration.hash))}appendEvent(e){this.events=[e,...this.events]}sendClientEvent(e){e.event_id=e.event_id||crypto.randomUUID();let t=JSON.stringify(e);(this.hosted?this.hosted.send(t):this.session?.send(t))?this.appendEvent(e):console.error("Failed to send message - no data channel available",e)}registerTools(){this.isToolsAdded=!0,this.registerTool({type:"function",name:"set_personality_color",description:"returns a color based on the voice personality of the ai assistant. This should be called by the voice assistant each time it is asks to speak differently. If a color cannot be associated to the personality, the color should be a neutral color.",parameters:{type:"object",properties:{color:{type:"string",description:"css hex color string, reflecting the personality"},personality:{type:"string",description:"the personality of the voice assistant"}},required:["color","personality"]}},({color:e})=>{this.setColorByName("Voice Assistant Color",e)});let e=this.shared.getVariablesNames().join(", ");this.registerTool({type:"function",name:"set_variable",description:"Sets a Spline variable value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the variable that needs to be set. Here's a list of available variables: ${e}. It the variable does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"The new value for this variable, should always be a string even for number and boolean variables, assume that the value will be cast to the proper type afterwards."}},required:["name","value","type"]}},({name:e,value:t})=>{let s=this.shared.getVariableByName(e);if(s){let e,i=this.shared.getVariable(s.id);e="number"==typeof i?parseFloat(t):"boolean"==typeof i?"true"===t.toLowerCase():{textValue:t},this.shared.updateVariable(s.id,e)}});let t=this.shared.getColorNames().join(", ");this.registerTool({type:"function",name:"set_color",description:"Sets a Spline color asset value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the color asset that needs to be set. Here's a list of available color assets: ${t}. It the color asset does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"css hex color string"}},required:["name","value"]}},({name:e,value:t})=>{this.setColorByName(e,t)});let s=this.shared.scene,i=[];s.traverseEntity(e=>{e.data.events.forEach(e=>{if("AIAssistantTrigger"===e.data.type){let{description:t}=e.data;i.push(t)}})}),this.registerTool({type:"function",name:"trigger_event",description:"Trigger an event by name, here are the available events, please match what the user is asking for to one of these if it applies, otherwise don't call the function and warn the user.",parameters:{type:"object",properties:{description:{type:"string",description:`The name of the event that needs to be triggered. Here's a list of available events: ${JSON.stringify(i)}.`},direction:{type:"string",description:"default is forward, but can be forward or backward. Always set to forward unless the user ask to reverse or cancel the event, then set to backward."}},required:["description","direction"]}},({description:e,direction:t})=>{this.emitter.emit("trigger_event",{description:e,direction:t})}),this.sendClientEvent({type:"session.update",session:{type:"realtime",tools:this.tools.map(([e])=>e)}})}registerTool(e,t){this.tools.push([e,t])}disconnect(){this.voice=0,this.isConnected=!1,this.isToolsAdded=!1,this.session?.disconnect(),this.session=void 0,this.hosted?.disconnect(),this.hosted=null}computeAnalysisForListenerEvent(e){if("range"===e.analysis){let t=this.frequencies.slice(...e.analysisRange);return t.reduce((e,t)=>e+t,0)/t.length}return"single"===e.analysis?this.frequencies[e.analysisSingle]:this.voice}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}};s("AIAssistantListener",({eventContext:e,eventManager:t})=>new r(e,t)),s("AIAssistantTrigger",({eventContext:e,eventManager:t})=>new c(e,t)),i((e,t,s)=>new w(e,t,s)),n("ai-assistant");
|
|
1
|
+
import{a as e}from"./runtime-chunk-NTUTXO7Q.js";import{a as t,b as s}from"./runtime-chunk-DZNU62CT.js";import{c as i}from"./runtime-chunk-4YV3EXSU.js";import{f as a}from"./runtime-chunk-EPHVY3XO.js";import"./runtime-chunk-U4QOT2PX.js";import{a as n}from"./runtime-chunk-TZCHGFVF.js";import"./runtime-chunk-VPEJ5BFD.js";import"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var r=class extends t{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.onVoice=({value:e,frequencies:t})=>{this.events.forEach(e=>{e.dispatch()})}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"AIAssistantListener"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new o(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("voice",this.onVoice))}disconnect(){this.openAIRealtime?.off("voice",this.onVoice)}},o=class{constructor(e,t,s,i,n,r){this.id=e,this.data=t,this.object=s,this.actions=a(t,t.actions,i,n,r,s)}dispatch(){this.dispatchActions(this.actions)}dispatchActions(e){e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}},c=class extends t{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.onTriggerEvent=({description:e,direction:t})=>{let s=this.events.find(t=>t.data.description===e);s&&("backward"===t?s.dispatchReverse():s.dispatch())}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"AIAssistantTrigger"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new h(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("trigger_event",this.onTriggerEvent))}disconnect(){this.openAIRealtime?.off("trigger_event",this.onTriggerEvent)}},h=class{constructor(e,t,s,i,n,r){this.id=e,this.data=t,this.object=s,this.actions=a(t,t.actions,i,n,r,s)}dispatch(){let e=this.actions;e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}dispatchReverse(){let e=this.actions;e.Transition.forEach(e=>e.reverseFromCurrent()),e.Particles.forEach(e=>e.reverseFromCurrent()),e.Animation.forEach(e=>e.reverseFromCurrent()),e.SwitchCamera.forEach(e=>e.reverseFromCurrent()),e.Create.forEach(e=>e.dispatchStop())}},l=function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(e,t,s,i)=>String(t+t+s+s+i+i));let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},d=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],p=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],u=[],f=[];for(let e=1;e<=8;e++)for(let t=0;t<d.length;t++){let s=d[t];u.push(s/Math.pow(2,8-e)),f.push(p[t]+e)}var v=[32,2e3],m=u.filter((e,t)=>u[t]>v[0]&&u[t]<v[1]),y=f.filter((e,t)=>u[t]>v[0]&&u[t]<v[1]),g=class{static getFrequencies(e,t,s,i="frequency",a=-100,n=-30){s||(s=new Float32Array(e.frequencyBinCount),e.getFloatFrequencyData(s));let r,o,c,h=t/2,l=1/s.length*h;if("music"===i||"voice"===i){let e="voice"===i?m:u,t=Array(e.length).fill(a);for(let i=0;i<s.length;i++){let a=i*l,n=s[i];for(let s=e.length-1;s>=0;s--)if(a>e[s]){t[s]=Math.max(t[s],n);break}}r=t,o="voice"===i?m:u,c="voice"===i?y:f}else r=Array.from(s),o=r.map((e,t)=>l*t),c=o.map(e=>`${e.toFixed(2)} Hz`);let d=r.map(e=>Math.max(0,Math.min((e-a)/(n-a),1)));return{values:new Float32Array(d),frequencies:o,labels:c}}},E=class{constructor(e){this.value=0,this.frequencies=new Float32Array(0);let t=new AudioContext;this.source=t.createMediaStreamSource(e),this.analyser=t.createAnalyser(),this.source.connect(this.analyser),this.analyser.fftSize=8192,this.analyser.smoothingTimeConstant=.1}getFrequencies(e=-100,t=-30){if(!this.analyser)throw new Error("Not connected, please call .connect() first");return g.getFrequencies(this.analyser,44100,void 0,"voice",e,t)}update(){let e=this.getFrequencies(),t=e.values.reduce((e,t)=>e+t,0)/e.values.length;this.value=t,this.frequencies=e.values}disconnect(){this.source.disconnect(),this.analyser.disconnect()}},b=class{constructor(e){this.callbacks=e,this.rafId=0,this.isOpen=!1,this.onMessage=e=>{this.callbacks.onMessage(e.data)},this.onOpen=()=>{this.isOpen=!0,this.callbacks.onOpen()},this.animate=()=>{this.rafId=requestAnimationFrame(this.animate),this.isOpen&&this.analyser&&(this.analyser.update(),this.callbacks.onVoice(this.analyser.value,this.analyser.frequencies))}}async connect(e){let t=await async function(e){try{return(await(await fetch("https://relayserver.spline.design/session?uuidfile="+e)).json()).token}catch(e){console.error("Token generation error:",e)}}(e);this.pc=new RTCPeerConnection,this.audioElement=document.createElement("audio"),this.audioElement.autoplay=!0,this.pc.ontrack=e=>{let t=e.streams[0];this.audioElement.srcObject=t,this.analyser=new E(t)};let s=await navigator.mediaDevices.getUserMedia({audio:!0});this.pc.addTrack(s.getTracks()[0]),this.dc=this.pc.createDataChannel("oai-events"),this.dc.addEventListener("message",this.onMessage),this.dc.addEventListener("open",this.onOpen);let i=await this.pc.createOffer();await this.pc.setLocalDescription(i);let a={type:"answer",sdp:await(await fetch("https://api.openai.com/v1/realtime/calls?model=gpt-realtime",{method:"POST",body:i.sdp,headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/sdp"}})).text()};await this.pc.setRemoteDescription(a),this.animate()}send(e){return!!this.dc&&(this.dc.send(e),!0)}disconnect(){cancelAnimationFrame(this.rafId),this.analyser?.disconnect(),this.isOpen=!1,this.dc?.removeEventListener("message",this.onMessage),this.dc?.removeEventListener("open",this.onOpen),this.dc?.close(),this.pc?.getSenders().forEach(e=>{e.track&&e.track.stop()}),this.pc?.close(),this.pc=void 0}};var w=class{constructor(t,s,i){this.data=t,this.id=s,this.shared=i,this.emitter=e(),this.voice=0,this.frequencies=new Float32Array([0]),this.events=[],this.isConnected=!1,this.isToolsAdded=!1,this.tools=[],this.onServerEvent=e=>{let t=JSON.parse(e);if(this.appendEvent(t),"session.created"===t.type&&this.onSessionCreated(),"response.done"===t.type&&t.response?.output)for(let e of t.response.output)if("function_call"===e.type)for(let[t,s]of this.tools)e.name===t.name&&(s(JSON.parse(e.arguments)),setTimeout(()=>{this.sendClientEvent({type:"response.create",response:{instructions:"notice the user about what you just did"}})}))},this.onSessionCreated=()=>{this.isToolsAdded||this.registerTools()},this.onOpen=()=>{this.events=[],this.isConnected=!0,this.sendClientEvent({type:"response.create",response:{instructions:"Say hi"}})}}update(e){this.data=e}setColorByName(e,t){let s=this.shared.getColorByName(e);if(s){let{id:e}=s,{r:i,g:a,b:n}=l(t)??{r:0,g:0,b:0};this.shared.updateColor(e,{r:i/255,g:a/255,b:n/255})}}async connect(){if(this.isConnected||this.session||this.hosted)return;let e={onMessage:this.onServerEvent,onOpen:this.onOpen,onVoice:(e,t)=>{this.voice=e,this.frequencies=t,this.emitter.emit("voice",{value:e,frequencies:t})}};this.hosted=function(e,t,s){if(!function(){try{return!0===window.__SPLINE_PLAY_VOICE_HOST__&&window.parent!==window}catch{return!1}}())return null;let i=!1,a=e=>{window.parent.postMessage({__splinePlayFrame:!0,...e},"*")},n=t=>{if(t.source!==window.parent)return;let a=t.data;!a||!0!==a.__splinePlayFrameHost||a.id!==e||("voice-open"===a.type?(i=!0,s.onOpen()):"voice-message"===a.type&&"string"==typeof a.data?s.onMessage(a.data):"voice-level"===a.type&&"number"==typeof a.value?s.onVoice(a.value,a.frequencies instanceof Float32Array?a.frequencies:new Float32Array(0)):"voice-error"===a.type&&console.error("Voice assistant host error:",a.message))};return window.addEventListener("message",n),a({type:"voice-connect",id:e,hash:t}),{send:t=>!!i&&(a({type:"voice-send",id:e,message:t}),!0),disconnect:()=>{i=!1,window.removeEventListener("message",n),a({type:"voice-disconnect",id:e})}}}(this.id,this.data.integration.hash,e),!this.hosted&&(this.session=new b(e),await this.session.connect(this.data.integration.hash))}appendEvent(e){this.events=[e,...this.events]}sendClientEvent(e){e.event_id=e.event_id||crypto.randomUUID();let t=JSON.stringify(e);(this.hosted?this.hosted.send(t):this.session?.send(t))?this.appendEvent(e):console.error("Failed to send message - no data channel available",e)}registerTools(){this.isToolsAdded=!0,this.registerTool({type:"function",name:"set_personality_color",description:"returns a color based on the voice personality of the ai assistant. This should be called by the voice assistant each time it is asks to speak differently. If a color cannot be associated to the personality, the color should be a neutral color.",parameters:{type:"object",properties:{color:{type:"string",description:"css hex color string, reflecting the personality"},personality:{type:"string",description:"the personality of the voice assistant"}},required:["color","personality"]}},({color:e})=>{this.setColorByName("Voice Assistant Color",e)});let e=this.shared.getVariablesNames().join(", ");this.registerTool({type:"function",name:"set_variable",description:"Sets a Spline variable value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the variable that needs to be set. Here's a list of available variables: ${e}. It the variable does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"The new value for this variable, should always be a string even for number and boolean variables, assume that the value will be cast to the proper type afterwards."}},required:["name","value","type"]}},({name:e,value:t})=>{let s=this.shared.getVariableByName(e);if(s){let e,i=this.shared.getVariable(s.id);e="number"==typeof i?parseFloat(t):"boolean"==typeof i?"true"===t.toLowerCase():{textValue:t},this.shared.updateVariable(s.id,e)}});let t=this.shared.getColorNames().join(", ");this.registerTool({type:"function",name:"set_color",description:"Sets a Spline color asset value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the color asset that needs to be set. Here's a list of available color assets: ${t}. It the color asset does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"css hex color string"}},required:["name","value"]}},({name:e,value:t})=>{this.setColorByName(e,t)});let s=this.shared.scene,i=[];s.traverseEntity(e=>{e.data.events.forEach(e=>{if("AIAssistantTrigger"===e.data.type){let{description:t}=e.data;i.push(t)}})}),this.registerTool({type:"function",name:"trigger_event",description:"Trigger an event by name, here are the available events, please match what the user is asking for to one of these if it applies, otherwise don't call the function and warn the user.",parameters:{type:"object",properties:{description:{type:"string",description:`The name of the event that needs to be triggered. Here's a list of available events: ${JSON.stringify(i)}.`},direction:{type:"string",description:"default is forward, but can be forward or backward. Always set to forward unless the user ask to reverse or cancel the event, then set to backward."}},required:["description","direction"]}},({description:e,direction:t})=>{this.emitter.emit("trigger_event",{description:e,direction:t})}),this.sendClientEvent({type:"session.update",session:{type:"realtime",tools:this.tools.map(([e])=>e)}})}registerTool(e,t){this.tools.push([e,t])}disconnect(){this.voice=0,this.isConnected=!1,this.isToolsAdded=!1,this.session?.disconnect(),this.session=void 0,this.hosted?.disconnect(),this.hosted=null}computeAnalysisForListenerEvent(e){if("range"===e.analysis){let t=this.frequencies.slice(...e.analysisRange);return t.reduce((e,t)=>e+t,0)/t.length}return"single"===e.analysis?this.frequencies[e.analysisSingle]:this.voice}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}};s("AIAssistantListener",({eventContext:e,eventManager:t})=>new r(e,t)),s("AIAssistantTrigger",({eventContext:e,eventManager:t})=>new c(e,t)),i((e,t,s)=>new w(e,t,s)),n("ai-assistant");
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./runtime-chunk-NTUTXO7Q.js";import{a as t,b as s}from"./runtime-chunk-DZNU62CT.js";import{a as r}from"./runtime-chunk-4YV3EXSU.js";import{b as i,e as n,f as o}from"./runtime-chunk-NWCLOXDY.js";import{a}from"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-R34HNX2O.js";import{a as h}from"./runtime-chunk-TZCHGFVF.js";import{Ga as c,Ha as d,o as u}from"./runtime-chunk-RBM3UDQF.js";import"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var l=class extends t{constructor(e,t){super(e),this.eventManager=t,this.userAPIs={},this.events=[],this.onSuccess=({userAPIId:e})=>{this.events.forEach(t=>{t.data.userAPIId===e&&t.dispatchSuccess()})},this.onError=({userAPIId:e})=>{this.events.forEach(t=>{t.data.userAPIId===e&&t.dispatchError()})},this.userAPIs=e.sharedAssets.getUserAPIs()}connect(){this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"API"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new p(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),Object.entries(this.userAPIs).forEach(([e,t])=>{t.on("success",this.onSuccess),t.on("error",this.onError),t.autostart&&t.callUserAPI(this.eventContext.sharedAssets)})}disconnect(){Object.entries(this.userAPIs).forEach(([e,t])=>{t.off("success",this.onSuccess),t.off("error",this.onError)})}},p=class{constructor(e,t,s,r,i,n){this.id=e,this.data=t,this.object=s,this.successActions=o(t,t.successActions,r,i,n,s),this.errorActions=o(t,t.errorActions,r,i,n,s)}dispatchSuccess(){this.dispatchActions(this.successActions)}dispatchError(){this.dispatchActions(this.errorActions)}dispatchActions(e){e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}},f=class extends t{constructor(e,t){super(e),this.eventManager=t,this.userWebhooks={},this.events=[],this.onMessage=({userWebhookId:e})=>{this.events.forEach(t=>{t.data.userWebhookId===e&&t.dispatch()})},this.userWebhooks=e.sharedAssets.getUserWebhooks()}connect(){this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"WEBHOOK"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new m(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),Object.entries(this.userWebhooks).forEach(([e,t])=>{t.connect(),t.on("message",this.onMessage)})}disconnect(){Object.entries(this.userWebhooks).forEach(([e,t])=>{t.off("message",this.onMessage),t.disconnect()})}},m=class{constructor(e,t,s,r,i,n){this.id=e,this.data=t,this.object=s,this.actions=o(t,t.actions,r,i,n,s)}dispatch(){let e=this.actions;e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}},v=class{constructor(e,t,s,r){this.data=e,this.page=t,this.shared=s,this.condition=r}dispatch(){if(!1===n(this.shared,this.condition))return!1;if(this.data.userAPIId){let e=this.shared.getUserAPI(this.data.userAPIId);e&&"callUserAPI"in e&&e.callUserAPI(this.shared)}}dispose(){}},E=class{constructor(t,s,r){this.id=t,this.userAPI=s,this.result=void 0,this.error="null",this.isPrefetched=!1,this.isLoading=!1,this.isLoaded=!1,this.prefetchPromise=new Promise(e=>e()),this.emitter=e(),this._innerCallUserAPI=async e=>{this.emitter.emit("start",{userAPIId:this.id}),this.isLoading=!0,this.isLoading=!1;try{this.result=await async function(e,t,s=new AbortController){let r,i,n=e.url,o=e.proxy?.enabled??!1;if("OpenAI"===e.integration?.type){let s=b(""===e.integration.prompt?[]:JSON.parse(e.integration.prompt),t),r=""===e.integration.behavior?[]:b(JSON.parse(e.integration.behavior),t);i=`{\n\t\t"model": "${e.integration.model}",\n\t\t"messages": [${e.integration.useBehavior?`\n\t\t{\n\t\t\t"role": "system",\n\t\t\t"content": "${r}"\n\t\t},`:""}\n\t\t{\n\t\t\t"role": "user",\n\t\t\t"content": "${s}"\n\t\t}\n\t\t]\n\t}`}if(o){let s;n=`https://apis.spline.design/file/${e.proxy.fileId}/external-api/request?uuidexternalapi=${e.proxy.proxyId}`,void 0!==i?s=i:"POST"===e.method&&e.body&&(s=b(JSON.parse(e.body),t)),void 0!==s&&(n+=`&data=${encodeURIComponent(s.replace(/(\r\n|\n|\r|\t)/gm,""))}`)}else"OpenAI"===e.integration?.type?r=i:"POST"===e.method&&e.body&&(r=b(JSON.parse(e.body),t));let a=await fetch(n,{method:o?"GET":e.method,headers:o?void 0:g(e),signal:s.signal,body:r});if(!a.ok)throw new Error("status:"+a.status+"_:_"+a.statusText);if("OpenAI"===e.integration?.type){let e=await a.json();return o&&(e=e.response),{content:e.choices[0].message.content}}{let e=await a.json();return o&&(e=e.response),e}}(this.userAPI,e),this.error="null",this.emitter.emit("success",{userAPIId:this.id})}catch(e){let t=e.message?.split("_:_")?.[0]?.replace("status:","")??"null";this.error=t,this.result=null,this.emitter.emit("error",{userAPIId:this.id})}this.isLoading=!1,this.isPrefetched=!0,this.isLoaded=!0},"OpenAI"===s?.integration?.type?this.result={content:""}:"GET"===s.method&&""!==s.url&&(this.prefetchPromise=this.prefetch(r)),this._debouncedCallUserAPI=this._innerCallUserAPI,this._updateDebouncedCallUserAPI(),this._debouncedPrefetch=a(this.prefetch,1e3,{trailing:!0})}_updateDebouncedCallUserAPI(){this._debouncedCallUserAPI=void 0!==this.userAPI.debounce&&this.userAPI.debounce>0?a(this._innerCallUserAPI,this.userAPI.debounce,{leading:!0,trailing:!0}):this._innerCallUserAPI}async prefetch(e){await this.callUserAPI(e)}async callUserAPI(e){await this._debouncedCallUserAPI(e)}update(e,t,s=!0){this.userAPI=e,this._updateDebouncedCallUserAPI(),""!==this.userAPI.url&&"GET"===this.userAPI.method&&s&&this._debouncedPrefetch(t)}retrieveValue(e){if(this.result)try{return u.zoom(this.result,e)}catch(e){console.error(e)}}retrieveZoomedKeyValues(e){if(this.result){let s=e&&e.length?u.zoom(this.result,e):this.result;if("object"==typeof(t=s)&&null!==t)return Object.entries(s);if(function(e){return Array.isArray(e)}(s))return s.map((e,t)=>[t.toString(),e]);throw function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null===e}(s)?new Error("This path points to a value, use retrieveValue() instead. "+e?.join(".")):new Error("Path error"+e?.join("."))}var t}dispose(){}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}get autostart(){return this.userAPI.autoStart}};function g(e){let t=new Headers;return e.headers.forEach(e=>{""!==e.data.key&&t.append(e.data.key,e.data.value)}),t}var A=(e,t)=>{if("string"==typeof e){let s=t.getVariable(e);if(s)return A(s,t)}return d.isBoolean(e)?d.getDisplayedValue(e).toLowerCase():d.getDisplayedValue(e)},b=(e,t)=>e.map((e,s)=>{if("text"in e)return e.text;if("type"in e){if("paragraph"===e.type)return(s>0?"\n":"")+b(e.children,t);if("variable"===e.type){let s=t.getVariable(e.variableId);if(void 0!==s)return A(s,t)}}return""}).join(""),I=1e3,P=512*I,y=class{constructor(t,s){this.id=t,this.userWebhook=s,this.result=void 0,this._connected=!1,this.emitter=e(),this.reconnectWaitFor=I,this._onError=e=>{this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this._scheduleReconnect()},this._onConnected=e=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=I,this._connected=!0},this._onDisconnected=()=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=I,this._connected=!1},this._onMessage=e=>{let t,s=e.data;try{t=JSON.parse(s)}catch(e){console.error("Error parsing webhook message",e)}if(t){let e=!1;this.userWebhook.parametersSchemas.forEach(({data:s})=>{void 0!==t[s.name]&&function(e,t){let s=typeof e;return!!(("string"===t||"number"===t)&&s===t||"boolean"===t&&("true"===e||"false"===e||!0===e||!1===e)||"image"===t&&"string"===s&&e.startsWith("http"))}(t[s.name],s.type)&&(void 0===this.result&&(this.result={}),this.result[s.name]=t[s.name],e=!0)}),e&&this.emitter.emit("message",{userWebhookId:this.id})}}}connect(){clearTimeout(this.scheduledReconnectHandle),this.userWebhook.url&&(this.eventSource=new EventSource("https://hooks.spline.design/events?hashFile="+this.userWebhook.url),this.eventSource.addEventListener("message",this._onMessage),this.eventSource.addEventListener("error",this._onError),this.eventSource.addEventListener("open",this._onConnected))}disconnect(){this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this.eventSource?.close(),this._onDisconnected(),clearTimeout(this.scheduledReconnectHandle)}_scheduleReconnect(){this.reconnectWaitFor*=2,this.reconnectWaitFor>P&&(this.reconnectWaitFor=P),clearTimeout(this.scheduledReconnectHandle),this.scheduledReconnectHandle=setTimeout(()=>{this.scheduledReconnectHandle=void 0,this.connect()},this.reconnectWaitFor)}update(e){this.userWebhook=e}dispose(){this._connected&&this.disconnect()}get connected(){return this._connected}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}getParametersKeys(){return this.userWebhook.parametersSchemas.map(e=>e.data.name)}getParameterValue(e){if(this.getParametersKeys().includes(e)){if(this.result)return this.result?.[e];for(let t of this.userWebhook.parametersSchemas)if(t.data.name===e)return c.defaultParameterValueByType(t.data.type)}}};s("API",({eventContext:e,eventManager:t})=>new l(e,t)),s("WEBHOOK",({eventContext:e,eventManager:t})=>new f(e,t)),i("UserAPI",({data:e,page:t,shared:s,actionCondition:r})=>new v(e,t,s,r)),r({createUserAPI:(e,t,s)=>new E(e,t,s),createUserWebhook:(e,t)=>new y(e,t)}),h("api-services");
|
|
1
|
+
import{a as e}from"./runtime-chunk-NTUTXO7Q.js";import{a as t,b as s}from"./runtime-chunk-DZNU62CT.js";import{a as r}from"./runtime-chunk-4YV3EXSU.js";import{b as i,e as n,f as o}from"./runtime-chunk-EPHVY3XO.js";import{a}from"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-U4QOT2PX.js";import{a as h}from"./runtime-chunk-TZCHGFVF.js";import{Ga as c,Ha as d,o as u}from"./runtime-chunk-VPEJ5BFD.js";import"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var l=class extends t{constructor(e,t){super(e),this.eventManager=t,this.userAPIs={},this.events=[],this.onSuccess=({userAPIId:e})=>{this.events.forEach(t=>{t.data.userAPIId===e&&t.dispatchSuccess()})},this.onError=({userAPIId:e})=>{this.events.forEach(t=>{t.data.userAPIId===e&&t.dispatchError()})},this.userAPIs=e.sharedAssets.getUserAPIs()}connect(){this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"API"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new p(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),Object.entries(this.userAPIs).forEach(([e,t])=>{t.on("success",this.onSuccess),t.on("error",this.onError),t.autostart&&t.callUserAPI(this.eventContext.sharedAssets)})}disconnect(){Object.entries(this.userAPIs).forEach(([e,t])=>{t.off("success",this.onSuccess),t.off("error",this.onError)})}},p=class{constructor(e,t,s,r,i,n){this.id=e,this.data=t,this.object=s,this.successActions=o(t,t.successActions,r,i,n,s),this.errorActions=o(t,t.errorActions,r,i,n,s)}dispatchSuccess(){this.dispatchActions(this.successActions)}dispatchError(){this.dispatchActions(this.errorActions)}dispatchActions(e){e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}},f=class extends t{constructor(e,t){super(e),this.eventManager=t,this.userWebhooks={},this.events=[],this.onMessage=({userWebhookId:e})=>{this.events.forEach(t=>{t.data.userWebhookId===e&&t.dispatch()})},this.userWebhooks=e.sharedAssets.getUserWebhooks()}connect(){this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"WEBHOOK"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new m(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),Object.entries(this.userWebhooks).forEach(([e,t])=>{t.connect(),t.on("message",this.onMessage)})}disconnect(){Object.entries(this.userWebhooks).forEach(([e,t])=>{t.off("message",this.onMessage),t.disconnect()})}},m=class{constructor(e,t,s,r,i,n){this.id=e,this.data=t,this.object=s,this.actions=o(t,t.actions,r,i,n,s)}dispatch(){let e=this.actions;e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}},v=class{constructor(e,t,s,r){this.data=e,this.page=t,this.shared=s,this.condition=r}dispatch(){if(!1===n(this.shared,this.condition))return!1;if(this.data.userAPIId){let e=this.shared.getUserAPI(this.data.userAPIId);e&&"callUserAPI"in e&&e.callUserAPI(this.shared)}}dispose(){}},E=class{constructor(t,s,r){this.id=t,this.userAPI=s,this.result=void 0,this.error="null",this.isPrefetched=!1,this.isLoading=!1,this.isLoaded=!1,this.prefetchPromise=new Promise(e=>e()),this.emitter=e(),this._innerCallUserAPI=async e=>{this.emitter.emit("start",{userAPIId:this.id}),this.isLoading=!0,this.isLoading=!1;try{this.result=await async function(e,t,s=new AbortController){let r,i,n=e.url,o=e.proxy?.enabled??!1;if("OpenAI"===e.integration?.type){let s=b(""===e.integration.prompt?[]:JSON.parse(e.integration.prompt),t),r=""===e.integration.behavior?[]:b(JSON.parse(e.integration.behavior),t);i=`{\n\t\t"model": "${e.integration.model}",\n\t\t"messages": [${e.integration.useBehavior?`\n\t\t{\n\t\t\t"role": "system",\n\t\t\t"content": "${r}"\n\t\t},`:""}\n\t\t{\n\t\t\t"role": "user",\n\t\t\t"content": "${s}"\n\t\t}\n\t\t]\n\t}`}if(o){let s;n=`https://apis.spline.design/file/${e.proxy.fileId}/external-api/request?uuidexternalapi=${e.proxy.proxyId}`,void 0!==i?s=i:"POST"===e.method&&e.body&&(s=b(JSON.parse(e.body),t)),void 0!==s&&(n+=`&data=${encodeURIComponent(s.replace(/(\r\n|\n|\r|\t)/gm,""))}`)}else"OpenAI"===e.integration?.type?r=i:"POST"===e.method&&e.body&&(r=b(JSON.parse(e.body),t));let a=await fetch(n,{method:o?"GET":e.method,headers:o?void 0:g(e),signal:s.signal,body:r});if(!a.ok)throw new Error("status:"+a.status+"_:_"+a.statusText);if("OpenAI"===e.integration?.type){let e=await a.json();return o&&(e=e.response),{content:e.choices[0].message.content}}{let e=await a.json();return o&&(e=e.response),e}}(this.userAPI,e),this.error="null",this.emitter.emit("success",{userAPIId:this.id})}catch(e){let t=e.message?.split("_:_")?.[0]?.replace("status:","")??"null";this.error=t,this.result=null,this.emitter.emit("error",{userAPIId:this.id})}this.isLoading=!1,this.isPrefetched=!0,this.isLoaded=!0},"OpenAI"===s?.integration?.type?this.result={content:""}:"GET"===s.method&&""!==s.url&&(this.prefetchPromise=this.prefetch(r)),this._debouncedCallUserAPI=this._innerCallUserAPI,this._updateDebouncedCallUserAPI(),this._debouncedPrefetch=a(this.prefetch,1e3,{trailing:!0})}_updateDebouncedCallUserAPI(){this._debouncedCallUserAPI=void 0!==this.userAPI.debounce&&this.userAPI.debounce>0?a(this._innerCallUserAPI,this.userAPI.debounce,{leading:!0,trailing:!0}):this._innerCallUserAPI}async prefetch(e){await this.callUserAPI(e)}async callUserAPI(e){await this._debouncedCallUserAPI(e)}update(e,t,s=!0){this.userAPI=e,this._updateDebouncedCallUserAPI(),""!==this.userAPI.url&&"GET"===this.userAPI.method&&s&&this._debouncedPrefetch(t)}retrieveValue(e){if(this.result)try{return u.zoom(this.result,e)}catch(e){console.error(e)}}retrieveZoomedKeyValues(e){if(this.result){let s=e&&e.length?u.zoom(this.result,e):this.result;if("object"==typeof(t=s)&&null!==t)return Object.entries(s);if(function(e){return Array.isArray(e)}(s))return s.map((e,t)=>[t.toString(),e]);throw function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null===e}(s)?new Error("This path points to a value, use retrieveValue() instead. "+e?.join(".")):new Error("Path error"+e?.join("."))}var t}dispose(){}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}get autostart(){return this.userAPI.autoStart}};function g(e){let t=new Headers;return e.headers.forEach(e=>{""!==e.data.key&&t.append(e.data.key,e.data.value)}),t}var A=(e,t)=>{if("string"==typeof e){let s=t.getVariable(e);if(s)return A(s,t)}return d.isBoolean(e)?d.getDisplayedValue(e).toLowerCase():d.getDisplayedValue(e)},b=(e,t)=>e.map((e,s)=>{if("text"in e)return e.text;if("type"in e){if("paragraph"===e.type)return(s>0?"\n":"")+b(e.children,t);if("variable"===e.type){let s=t.getVariable(e.variableId);if(void 0!==s)return A(s,t)}}return""}).join(""),P=1e3,I=512*P,y=class{constructor(t,s){this.id=t,this.userWebhook=s,this.result=void 0,this._connected=!1,this.emitter=e(),this.reconnectWaitFor=P,this._onError=e=>{this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this._scheduleReconnect()},this._onConnected=e=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=P,this._connected=!0},this._onDisconnected=()=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=P,this._connected=!1},this._onMessage=e=>{let t,s=e.data;try{t=JSON.parse(s)}catch(e){console.error("Error parsing webhook message",e)}if(t){let e=!1;this.userWebhook.parametersSchemas.forEach(({data:s})=>{void 0!==t[s.name]&&function(e,t){let s=typeof e;return!!(("string"===t||"number"===t)&&s===t||"boolean"===t&&("true"===e||"false"===e||!0===e||!1===e)||"image"===t&&"string"===s&&e.startsWith("http"))}(t[s.name],s.type)&&(void 0===this.result&&(this.result={}),this.result[s.name]=t[s.name],e=!0)}),e&&this.emitter.emit("message",{userWebhookId:this.id})}}}connect(){clearTimeout(this.scheduledReconnectHandle),this.userWebhook.url&&(this.eventSource=new EventSource("https://hooks.spline.design/events?hashFile="+this.userWebhook.url),this.eventSource.addEventListener("message",this._onMessage),this.eventSource.addEventListener("error",this._onError),this.eventSource.addEventListener("open",this._onConnected))}disconnect(){this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this.eventSource?.close(),this._onDisconnected(),clearTimeout(this.scheduledReconnectHandle)}_scheduleReconnect(){this.reconnectWaitFor*=2,this.reconnectWaitFor>I&&(this.reconnectWaitFor=I),clearTimeout(this.scheduledReconnectHandle),this.scheduledReconnectHandle=setTimeout(()=>{this.scheduledReconnectHandle=void 0,this.connect()},this.reconnectWaitFor)}update(e){this.userWebhook=e}dispose(){this._connected&&this.disconnect()}get connected(){return this._connected}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}getParametersKeys(){return this.userWebhook.parametersSchemas.map(e=>e.data.name)}getParameterValue(e){if(this.getParametersKeys().includes(e)){if(this.result)return this.result?.[e];for(let t of this.userWebhook.parametersSchemas)if(t.data.name===e)return c.defaultParameterValueByType(t.data.type)}}};s("API",({eventContext:e,eventManager:t})=>new l(e,t)),s("WEBHOOK",({eventContext:e,eventManager:t})=>new f(e,t)),i("UserAPI",({data:e,page:t,shared:s,actionCondition:r})=>new v(e,t,s,r)),r({createUserAPI:(e,t,s)=>new E(e,t,s),createUserWebhook:(e,t)=>new y(e,t)}),h("api-services");
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as t}from"./runtime-chunk-NSD7DU3P.js";import{b as i,e as a}from"./runtime-chunk-
|
|
1
|
+
import{c as t}from"./runtime-chunk-NSD7DU3P.js";import{b as i,e as a}from"./runtime-chunk-EPHVY3XO.js";import"./runtime-chunk-U4QOT2PX.js";import{a as s}from"./runtime-chunk-TZCHGFVF.js";import"./runtime-chunk-VPEJ5BFD.js";import"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var e=new Map,o=new Map,d=class{constructor(i,a,s,d){this.data=a,this.isPlayAudioAction=!0;let{audio:n,volume:r,delay:h,loop:u}=a;if(!n)throw new Error("Missing property");try{let i="string"==typeof n?d.getAudio(n).src:n.data;this.audioPlayer=new t({src:i,volume:r,delay:h,loop:u})}catch{console.warn(`Could not create an audio player for this object: "${s.name}" and this audio: "${n}"`)}o.has(s.uuid)?o.get(s.uuid).push(this):o.set(s.uuid,[this]),e.set(i,this)}playByToggle(){"stop"===this.data.toggle?"playing"===this.audioPlayer?.status?this.audioPlayer.stop():(this.audioPlayer?.stop(),this.audioPlayer?.play()):"pause"===this.data.toggle?"playing"===this.audioPlayer?.status?this.audioPlayer?.pause():this.audioPlayer?.play():(this.audioPlayer?.stop(),this.audioPlayer?.play())}dispose(){this.audioPlayer?.stop()}},n=class{constructor(t){this.data=t,this.isPauseAudioAction=!0}dispatch(){this.data.playAudio?this.pauseAudio(this.data.playAudio):this.data.object?this.pauseAllAudiosFromObject(this.data.object):this.pauseAllAudios()}pauseAudio(t){let i=e.get(t);!i||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{i.audioPlayer?.[this.data.interaction](),this.disposeDelay()},this.data.delay)):i.audioPlayer?.[this.data.interaction]())}pauseAllAudiosFromObject(t){let i=o.get(t);!i?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{i.forEach(t=>t.audioPlayer?.[this.data.interaction]()),this.disposeDelay()},this.data.delay)):i.forEach(t=>t.audioPlayer?.[this.data.interaction]()))}pauseAllAudios(){let t=[...o.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(t=>{t.forEach(t=>{t.audioPlayer?.[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(t=>{t.forEach(t=>{t.audioPlayer?.[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},r=class{constructor(t,i,a,s,e){if(this.data=i,this.shared=s,this.condition=e,"play"===i.interaction)this.interaction=new d(t,i,a,s);else{if("pause"!==i.interaction&&"stop"!==i.interaction)throw new Error("Missing property");this.interaction=new n(i)}}dispatchBasic(){if(!1===a(this.shared,this.condition))return!1;this.interaction instanceof d?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(!1===a(this.shared,this.condition))return!1;this.interaction instanceof d?this.interaction.audioPlayer?.play():this.interaction.dispatch()}dispatchGameControl(t){if(!1===a(this.shared,this.condition))return!1;this.interaction instanceof d&&("start"===t?this.interaction.audioPlayer?.play():this.interaction.audioPlayer?.stop())}dispose(){this.interaction.dispose()}};i("Audio",({id:t,data:i,object:a,shared:s,actionCondition:e})=>new r(t,i,a,s,e)),s("audio");
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
k ��8&�"bh[�����N���_i��*9�.p�hӰ�Wϟ�X�$̝͌���f�i��W�h�{���3D��o&��sIZ'DJ�c4[%��I��ٰ��N�O�����������~����#�`�ϒ��S(M r���t_8�&;�m���vZO���Ȗ+g�F^du�x�0ë5�e����*���OQ���G��"uJ8L��HO������'��n>�WYF��\�A�u9������U9z�iWQ�K�3 ����RF��/zY���,Sa3���9�7�!�_Y��m_��Ji���9j�T+�)Ԙ`�����K�;���T�Z �k�}��\�M�xt;���bMx����U5?P���ݮkI�2�|��p��M��ѯHy�
|
|
2
|
+
Q�U����ܜ�9�� 3O4e]���2���pp��d�la=6�������ڳ8b�mn�u;����k� ��~�T�c�xF������k$0�H�tuX�����X��~xI`���ЭWj�6t7K���\nnC��o������C��NU[�Y�b��v9y3�����>�l��e.%i��5�@Tc �
|
|
3
|
+
&i,��Z�����Yc 4`H4��И*.����Q���kH;���0�&+en]^Qv�RX!�q�
|
|
4
|
+
�˙3<�*����3�=��F_V��c�M�[�������k*Ը�76!�{>g��R
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v as e}from"./runtime-chunk-4KX4KQWR.js";import{Ec as t,Fc as s,Fd as a,Gc as i,Ge as r,Ib as n,Oc as h,Tc as o,Wd as l,Xd as d,Zc as c,kd as u,ld as g}from"./runtime-chunk-VGN7YHB7.js";var p=null;function b(e){p=e}function S(){return p}var m=null;function f(e){m=e}function M(){return m}var y=new o;function R(e,t,s){return y.setRGB(e,t,s,n),{r:y.r,g:y.g,b:y.b}}var w=(e,t)=>"number"==typeof e&&Number.isFinite(e)?e:t,x=e=>Array.isArray(e)&&"number"==typeof e[0]&&"number"==typeof e[1]?[e[0],e[1]]:[0,0];function v(e,t,s){let a,i=w(e.angle,0),[r,n]=x(e.offset),[h,o]=x(e.morph),l=e.colors??[],d=e.steps??[],c=Math.min(10,l.length,d.length);if(0===c)return[1,1,1,1];if(1===e.gradientType){let e=3*(t+h)-(t+r)-1,l=3*(s+o)-(s+n)-1;a=Math.hypot(e,l)+i}else if(2===e.gradientType){let e=-1*Math.atan2(t+h-.5+r,s+o-.5+n),l=i/Math.PI/-2+.5*e/Math.PI;a=l-Math.floor(l)}else{let e=.5+h/(0!==t?t:1e-6),l=o/(0!==s?s:1e-6),d=Math.cos(i)*e-Math.sin(i)*l,c=Math.sin(i)*e+Math.cos(i)*l,u=d*d+c*c;a=u>1e-12?(((t-.5+r)/2+d/2)*d+((s-.5+n)/2+c/2)*c)/u:0}let u=l[0][0],g=l[0][1],p=l[0][2],b=l[0][3];for(let t=1;t<c;t++){let s=d[t-1],i=d[t]-s,r=0!==i?Math.min(1,Math.max(0,(a-s)/i)):a>=s?1:0;e.smooth&&(r=r*r*(3-2*r)),u+=(l[t][0]-u)*r,g+=(l[t][1]-g)*r,p+=(l[t][2]-p)*r,b+=(l[t][3]-b)*r}return[u,g,p,b]}function A(e,t){let s=e,a=s?.data?.layers;if(a&&"function"==typeof a.forEach){let e=t,s=[];return a.forEach(t=>{let a=t.data;if(!1===a.visible||!0===a.isMask)return;let i=w(a.alpha,1);if(!(i<=0))if("color"===a.type){let t,r=a.color;"string"==typeof r?t="function"==typeof e?.color?e.color(r):void 0:r&&"number"==typeof r.r&&(t=r),t&&s.push({kind:"color",layer:a,rgb:{...R(t.r,t.g,t.b),a:t.a??1},alpha:i})}else"gradient"===a.type&&s.push({kind:"gradient",layer:a,alpha:i})}),0===s.length?null:(e,t)=>{let a=1,i=1,r=1,n=!0;for(let h of s){let s,o,l,d;if("color"===h.kind)({r:s,g:o,b:l}=h.rgb),d=h.rgb.a;else{let[a,i,r,n]=v(h.layer,e,t);({r:s,g:o,b:l}=R(a,i,r)),d=n}let c=n?1:Math.min(1,Math.max(0,d*h.alpha));a+=(s-a)*c,i+=(o-i)*c,r+=(l-r)*c,n=!1}return{r:a,g:i,b:r}}}if(s?.color&&!0===s.color.isColor){let{r:e,g:t,b:a}=s.color;return()=>({r:e,g:t,b:a})}return null}var j=32,I=16384,F=32*I,W=100;function B(e,t){if("torus"===e){let e=t()*Math.PI*2,s=t()*Math.PI*2,a=Math.cos(e),i=Math.sin(e),r=Math.cos(s),n=Math.sin(s);return{x:(1.4+.7*r)*a,y:-(1.4+.7*r)*i,z:.7*n,nx:r*a,ny:-r*i,nz:n,cr:1,cg:1,cb:1}}if("cylinder"===e){let e=t()*Math.PI*2,s=Math.cos(e),a=Math.sin(e);return{x:.8*s,y:1.6*(t()-.5),z:.8*a,nx:s,ny:0,nz:a,cr:1,cg:1,cb:1}}let s=t()*Math.PI*2,a=2*t()-1,i=Math.acos(a),r=Math.sin(i)*Math.cos(s),n=Math.cos(i),h=Math.sin(i)*Math.sin(s);return{x:r,y:n,z:h,nx:r,ny:n,nz:h,cr:1,cg:1,cb:1}}function k(e){let{geometry:t,matrix:s}=e,a=t.getAttribute("position");if(!a||a.count<3)return null;let r=t.getAttribute("normal"),n=t.getAttribute("uv"),h=t.getAttribute("color"),o=t.getIndex(),l=o?o.count/3:a.count/3;if(l<1)return null;let d=(e,t)=>o?o.getX(3*e+t):3*e+t,c=s?s.elements:null,u=s?(new i).getNormalMatrix(s).elements:null,g=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[0]*t+c[4]*s+c[8]*i+c[12]:t},p=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[1]*t+c[5]*s+c[9]*i+c[13]:s},b=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[2]*t+c[6]*s+c[10]*i+c[14]:i},S=new Float64Array(l),m=0;for(let e=0;e<l;e++){let t=d(e,0),s=d(e,1),a=d(e,2),i=g(t),r=p(t),n=b(t),h=g(s)-i,o=p(s)-r,l=b(s)-n,c=g(a)-i,u=p(a)-r,f=b(a)-n,M=o*f-l*u,y=l*c-h*f,R=h*u-o*c;m+=.5*Math.sqrt(M*M+y*y+R*R),S[e]=m}return m<=0?null:{total:m,sample:(t,s)=>{let a=0,i=l-1;for(;a<i;){let e=a+i>>1;S[e]<t?a=e+1:i=e}let o=a,c=d(o,0),m=d(o,1),f=d(o,2),M=s(),y=s();M+y>1&&(M=1-M,y=1-y);let R,w,x,v=1-M-y,A=g(c)*v+g(m)*M+g(f)*y,j=p(c)*v+p(m)*M+p(f)*y,I=b(c)*v+b(m)*M+b(f)*y;if(r){if(R=r.getX(c)*v+r.getX(m)*M+r.getX(f)*y,w=r.getY(c)*v+r.getY(m)*M+r.getY(f)*y,x=r.getZ(c)*v+r.getZ(m)*M+r.getZ(f)*y,u){let e=u[0]*R+u[3]*w+u[6]*x,t=u[1]*R+u[4]*w+u[7]*x,s=u[2]*R+u[5]*w+u[8]*x;R=e,w=t,x=s}}else{let e=g(c),t=p(c),s=b(c),a=g(m)-e,i=p(m)-t,r=b(m)-s,n=g(f)-e,h=p(f)-t,o=b(f)-s;R=i*o-r*h,w=r*n-a*o,x=a*h-i*n}let F=Math.sqrt(R*R+w*w+x*x)||1,W=1,B=1,k=1;if(h)W=h.getX(c)*v+h.getX(m)*M+h.getX(f)*y,B=h.getY(c)*v+h.getY(m)*M+h.getY(f)*y,k=h.getZ(c)*v+h.getZ(m)*M+h.getZ(f)*y;else if(e.sampleColor){let t=n?n.getX(c)*v+n.getX(m)*M+n.getX(f)*y:.5,s=n?n.getY(c)*v+n.getY(m)*M+n.getY(f)*y:.5,a=e.sampleColor(t,s);a&&(W=a.r,B=a.g,k=a.b)}return{x:A,y:j,z:I,nx:R/F,ny:w/F,nz:x/F,cr:W,cg:B,cb:k}}}}function H(e){let t=Math.min(Math.max(1,Math.floor(e.guideStrands)),I),s=function(e){let t=e>>>0;return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(e.seed??1337),a="object"===e.shape&&e.sampler,i=a?e.samplerRadius??W:W,r=new Float32Array(4*F),n=new Float32Array(F),h=new Float32Array(4*I).fill(1);for(let o=0;o<t;o++){let t=a?e.sampler(s):B(e.shape,s),l=a?t.x:t.x*i,d=a?t.y:t.y*i,c=a?t.z:t.z*i,{nx:u,ny:g,nz:p}=t;h[4*o+0]=t.cr,h[4*o+1]=t.cg,h[4*o+2]=t.cb;let b,S,m,f=32*o,M=(1.8+.8*s())*e.hairLength*i/31,y=.5+1.5*s(),R=(.02+.06*s())*i;Math.abs(g)<.99?(b=-p,S=0,m=u):(b=1,S=0,m=0);let w=Math.sqrt(b*b+S*S+m*m)||1;for(let e=0;e<32;e++){let t=e/31,s=t*t*.4*i,a=R*Math.sin(t*y*Math.PI*2),h=4*(f+e);r[h+0]=l+u*M*e+a*b/w,r[h+1]=d+g*M*e-s+a*S/w,r[h+2]=c+p*M*e+a*m/w,r[h+3]=0===e?0:1,e<31&&(n[f+e]=M)}}return{initialPositions:r,restLengths:n,unitScale:i,rootColors:h}}var C=1/60,O=4,L=new h,P=new t,z=new s,X=new s,q=class extends e{constructor(e,a,i){super(e,a),this.type="HairSystem",this.isHairSystem=!0,this.simRunning=!1,this.previewRequested=!1,this.playModeActive=!1,this.pendingSimSeconds=0,this.simTime=0,this.resetRequested=!0,this.generation=0,this.settledSimSeconds=0,this.lastMotionFingerprint=0,this.lastBoneQuat=new t,this.lastBonePos=new s,this.hasLastBone=!1,this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,this.classicFallbackWarned=!1,this.regenSnapshot=null,this.context=i,this.data=a,this.geometry.setAttribute("position",new c(new Float32Array(0),3)),this.material=new u({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new g(new l(W,48,32),new u({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let n=new r;n.setAttribute("position",new c(new Float32Array(12),3)),n.setIndex([0,2,1,2,3,1]),n.instanceCount=0,this.ribbonMesh=new g(n,new u({visible:!1})),this.ribbonMesh.name="HairRibbons",this.ribbonMesh.frustumCulled=!1,this.ribbonMesh.visible=!1,this.ribbonMesh.matrixAutoUpdate=!1,this.ribbonMesh.updateMatrixWorld=()=>{this.ribbonMesh.matrixWorld.identity()},this.ribbonMesh.updateWorldMatrix=()=>{this.ribbonMesh.matrixWorld.identity()},this.add(this.ribbonMesh),this.activeGuideStrands=a.guideStrands,this.roots=this.buildRoots(),this.regenSnapshot={guideStrands:a.guideStrands,hairLength:a.hairLength,spreadRadius:a.spreadRadius,headShape:a.headShape,baseObjectId:a.baseObjectId},this.applyScalpState(),this.applyShadowState(),this.syncSimRunning()}update(e){!this.simRunning||(this.pendingSimSeconds=Math.min(this.pendingSimSeconds+e/1e3,4*C*2),this.trackMotionRest(e/1e3))}trackMotionRest(e){this.boneTransform(P,z);let t=this.hasLastBone&&(Math.abs(this.lastBoneQuat.dot(P))<.9999995||this.lastBonePos.distanceToSquared(z)>1e-8),s=this.motionFingerprint(),a=!this.hasLastBone||t||this.resetRequested||s!==this.lastMotionFingerprint||this.data.windStrength>.001;this.lastBoneQuat.copy(P),this.lastBonePos.copy(z),this.lastMotionFingerprint=s,this.hasLastBone=!0,this.settledSimSeconds=a?0:this.settledSimSeconds+e}motionFingerprint(){let e=this.data;return e.gravity+2*e.damping+3*e.localStiffness+4*e.globalStiffness+5*e.globalRange+6*e.stiffnessFalloff+7*e.windStrength+8*e.vspCoefficient+9*e.kink+10*e.kinkFrequency+11*e.clumpStrength+12*e.clumpSize+13*e.clumpTipScale}get isSimulating(){return(this.simRunning||this.resetRequested)&&this.visible}get isMotionSettled(){return this.settledSimSeconds>6}get isVisiblyAnimating(){return this.isSimulating&&!this.isMotionSettled}startPreview(){this.previewRequested=!0,this.syncSimRunning()}stopPreview(){this.previewRequested=!1,this.syncSimRunning()}setPlayMode(e){this.playModeActive=e,e&&this.resetSimulation(),this.syncSimRunning()}resetSimulation(){this.resetRequested=!0,this.pendingSimSeconds=0,this.simTime=0,this.settledSimSeconds=0}warnClassicFallbackOnce(){this.classicFallbackWarned||(this.classicFallbackWarned=!0,console.warn("[spline] Hair System strands require the WebGPU renderer — the WebGL fallback shows only the scalp. Reload with ?renderer=webgpu in a WebGPU-capable browser."))}syncSimRunning(){this.simRunning=this.playModeActive||this.previewRequested||this.data.autoPlay}updateState(e,t){super.updateState(e,t),this.updateHairState(e)}updateHairState(e){if((void 0!==e.guideStrands||void 0!==e.hairLength||void 0!==e.spreadRadius||void 0!==e.headShape||void 0!==e.baseObjectId)&&this.regenerate(),(void 0!==e.headShape||void 0!==e.baseObjectId)&&this.applyScalpState(),void 0!==e.headColor){let t=this.scalpMesh.material;!0===t.isMeshBasicMaterial&&t.color.setRGB(e.headColor.r,e.headColor.g,e.headColor.b,n)}(void 0!==e.castShadow||void 0!==e.receiveShadow)&&this.applyShadowState(),void 0!==e.autoPlay&&this.syncSimRunning()}applyShadowState(){let e=this.data.castShadow??!0,t=this.data.receiveShadow??!0;this.castShadow=e,this.receiveShadow=t,this.scalpMesh.castShadow=e,this.scalpMesh.receiveShadow=t,this.ribbonMesh.castShadow=e,this.ribbonMesh.receiveShadow=t}regenerate(){this.activeGuideStrands=Math.max(1,Math.min(Math.floor(this.data.guideStrands),16384)),this.roots=this.buildRoots(),this.generation++,this.regenSnapshot={guideStrands:this.data.guideStrands,hairLength:this.data.hairLength,spreadRadius:this.data.spreadRadius,headShape:this.data.headShape,baseObjectId:this.data.baseObjectId},this.resetSimulation()}checkDataDrift(){let e=this.data,t=this.regenSnapshot;if(null===t||t.guideStrands!==e.guideStrands||t.hairLength!==e.hairLength||t.spreadRadius!==e.spreadRadius||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId){let s=null===t||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId;this.regenerate(),s&&this.applyScalpState()}this.syncSimRunning(),this.applyShadowState(),this.checkBaseDrift()}buildRoots(){let{headShape:e,baseObjectId:t,guideStrands:s,hairLength:a}=this.data;if(this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,"object"===e&&t){let e=this.context.scene.find(t);if(e){this.baseFoundAtRegen=!0,e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),i=t?function(e){let t=[];for(let s of e){let e=k(s);e&&t.push(e)}if(0===t.length)return null;let s=new Float64Array(t.length),a=0;for(let e=0;e<t.length;e++)a+=t[e].total,s[e]=a;return a<=0?null:e=>{let i=e()*a,r=0,n=t.length-1;for(;r<n;){let e=r+n>>1;s[e]<i?r=e+1:n=e}let h=0===r?i:i-s[r-1];return t[r].sample(h,e)}}(t.sources):null;if(this.baseSourceGeomsAtRegen=t?.sources.map(e=>e.geometry)??[],this.baseSourceHashesAtRegen=t?.hashes??[],this.baseColorHashAtRegen=t?.colorHash??0,t&&i){let r=this.baseWorldScale(e),n=Math.max(t.radius*r,.001);this.baseScaleAtRegen=r;let h=r;return H({shape:"object",guideStrands:s,hairLength:a,sampler:e=>{let t=i(e);return{...t,x:t.x*h,y:t.y*h,z:t.z*h}},samplerRadius:n})}}}return H({shape:"object"===e?"sphere":e,guideStrands:s,hairLength:a})}collectBaseSources(e){let t=[],s=[],a=0,i=0;L.copy(e.matrixWorld).invert();let r=L.clone(),n=o=>{if(!0===o.isHairSystem||o!==e&&!1===o.visible)return;let l=o.geometry;if(!0===o.isMesh&&l&&(l.getAttribute("position")?.count??0)>=3){let n=o===e?void 0:(new h).multiplyMatrices(r,o.matrixWorld),d=Array.isArray(o.material)?o.material[0]:o.material;t.push({geometry:l,matrix:n,sampleColor:A(d,this.context.shared)??void 0}),s.push(q.matrixHash(n)),i+=function(e,t){let s=e,a=0,i=1,r=e=>{a+=e*i,i+=1},n=s?.data?.layers;if(n&&"function"==typeof n.forEach){let e=t;n.forEach(t=>{let s=t.data;if(!1!==s.visible)if("color"===s.type){let t=s.color,a="string"==typeof t?"function"==typeof e?.color?e.color(t):void 0:t;a&&"number"==typeof a.r&&(r(a.r),r(a.g),r(a.b)),r(w(s.alpha,1))}else if("gradient"===s.type){let e=s;for(let t of e.colors??[])r(t[0]),r(t[1]),r(t[2]),r(t[3]);for(let t of e.steps??[])r(t);r(w(e.angle,0)),r(e.gradientType),r(e.smooth?1:0)}})}else s?.color&&!0===s.color.isColor&&(r(s.color.r),r(s.color.g),r(s.color.b));return a}(d,this.context.shared),null===l.boundingSphere&&l.computeBoundingSphere();let c=l.boundingSphere;if(c){let e=0,t=1;n?(z.copy(c.center).applyMatrix4(n),e=z.length(),t=q.matrixMaxScale(n)):e=c.center.length(),a=Math.max(a,e+c.radius*t)}}for(let e of o.children)n(e)};return n(e),0===t.length?null:{sources:t,hashes:s,radius:Math.max(a,.001),colorHash:i}}static matrixHash(e){if(!e)return 0;let t=e.elements,s=0;for(let e=0;e<16;e++)s+=t[e]*(e+1);return s}static matrixMaxScale(e){let t=e.elements,s=Math.hypot(t[0],t[1],t[2]),a=Math.hypot(t[4],t[5],t[6]),i=Math.hypot(t[8],t[9],t[10]);return Math.max(s,a,i,1e-6)}baseWorldScale(e){return L.copy(e.matrixWorld).decompose(z,P,X),Math.max(Math.abs(X.x),Math.abs(X.y),Math.abs(X.z),1e-6)}get widthWorldScale(){return"object"===this.data.headShape&&this.data.baseObjectId&&this.baseScaleAtRegen>0?this.baseScaleAtRegen:1}checkBaseDrift(){if("object"!==this.data.headShape||!this.data.baseObjectId)return;let e=this.context.scene.find(this.data.baseObjectId);if(!e)return;if(!this.baseFoundAtRegen)return void this.regenerate();e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),s=t?.sources??[],a=t?.hashes??[],i=this.baseSourceGeomsAtRegen,r=this.baseSourceHashesAtRegen,n=s.length!==i.length;if(!n)for(let e=0;e<s.length;e++)if(s[e].geometry!==i[e]||Math.abs(a[e]-r[e])>1e-4*Math.max(Math.abs(r[e]),1)){n=!0;break}if(!n&&"object"===this.data.hairColorSource&&(t?.colorHash??0)!==this.baseColorHashAtRegen&&(n=!0),!n&&s.length>0){let t=this.baseWorldScale(e);n=Math.abs(t-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}n&&this.regenerate()}applyScalpState(){let e=this.data.headShape,t="object"===e&&null!==this.data.baseObjectId;this.scalpMesh.visible=!t,!t&&(this.scalpMesh.geometry.dispose(),this.scalpMesh.geometry="torus"===e?new d(140,70,24,48):"cylinder"===e?new a(80,80,160,48,1):new l(W,48,32))}boneTransform(e,t){let s=this.matrixWorld;if("object"===this.data.headShape&&this.data.baseObjectId){let e=this.context.scene.find(this.data.baseObjectId)?.matrixWorld;e&&(s=e)}L.copy(s).decompose(t,e,X)}raycast(e,t){if(!this.scalpMesh.visible)return;let s=[];this.scalpMesh.raycast(e,s);for(let e of s)e.object=this,t.push(e)}get shadowBoundsRadius(){let e="torus"===this.data.headShape?2.6:1.5;return this.roots.unitScale*(e+2.6*Math.max(this.data.hairLength,0))}getShadowBoundsCenter(e){return this.boneTransform(P,e),e}updateEntityBoxSize(e,t){let s=this.shadowBoundsRadius;e.set(0,0,0),t.set(s,s,s)}dispose(){super.dispose(),this.scalpMesh.geometry.dispose(),this.scalpMesh.material.dispose(),this.ribbonMesh.geometry.dispose(),this.ribbonMesh.material.dispose?.(),M()?.release(this)}};export{b as a,S as b,f as c,M as d,j as e,I as f,F as g,W as h,C as i,O as j,q as k};
|
|
1
|
+
import{v as e}from"./runtime-chunk-CKT62HES.js";import{Ec as t,Fc as s,Fd as a,Gc as i,Ge as r,Ib as n,Oc as h,Tc as o,Wd as l,Xd as d,Zc as c,kd as u,ld as g}from"./runtime-chunk-VGN7YHB7.js";var p=null;function b(e){p=e}function S(){return p}var m=null;function f(e){m=e}function M(){return m}var y=new o;function R(e,t,s){return y.setRGB(e,t,s,n),{r:y.r,g:y.g,b:y.b}}var w=(e,t)=>"number"==typeof e&&Number.isFinite(e)?e:t,x=e=>Array.isArray(e)&&"number"==typeof e[0]&&"number"==typeof e[1]?[e[0],e[1]]:[0,0];function v(e,t,s){let a,i=w(e.angle,0),[r,n]=x(e.offset),[h,o]=x(e.morph),l=e.colors??[],d=e.steps??[],c=Math.min(10,l.length,d.length);if(0===c)return[1,1,1,1];if(1===e.gradientType){let e=3*(t+h)-(t+r)-1,l=3*(s+o)-(s+n)-1;a=Math.hypot(e,l)+i}else if(2===e.gradientType){let e=-1*Math.atan2(t+h-.5+r,s+o-.5+n),l=i/Math.PI/-2+.5*e/Math.PI;a=l-Math.floor(l)}else{let e=.5+h/(0!==t?t:1e-6),l=o/(0!==s?s:1e-6),d=Math.cos(i)*e-Math.sin(i)*l,c=Math.sin(i)*e+Math.cos(i)*l,u=d*d+c*c;a=u>1e-12?(((t-.5+r)/2+d/2)*d+((s-.5+n)/2+c/2)*c)/u:0}let u=l[0][0],g=l[0][1],p=l[0][2],b=l[0][3];for(let t=1;t<c;t++){let s=d[t-1],i=d[t]-s,r=0!==i?Math.min(1,Math.max(0,(a-s)/i)):a>=s?1:0;e.smooth&&(r=r*r*(3-2*r)),u+=(l[t][0]-u)*r,g+=(l[t][1]-g)*r,p+=(l[t][2]-p)*r,b+=(l[t][3]-b)*r}return[u,g,p,b]}function A(e,t){let s=e,a=s?.data?.layers;if(a&&"function"==typeof a.forEach){let e=t,s=[];return a.forEach(t=>{let a=t.data;if(!1===a.visible||!0===a.isMask)return;let i=w(a.alpha,1);if(!(i<=0))if("color"===a.type){let t,r=a.color;"string"==typeof r?t="function"==typeof e?.color?e.color(r):void 0:r&&"number"==typeof r.r&&(t=r),t&&s.push({kind:"color",layer:a,rgb:{...R(t.r,t.g,t.b),a:t.a??1},alpha:i})}else"gradient"===a.type&&s.push({kind:"gradient",layer:a,alpha:i})}),0===s.length?null:(e,t)=>{let a=1,i=1,r=1,n=!0;for(let h of s){let s,o,l,d;if("color"===h.kind)({r:s,g:o,b:l}=h.rgb),d=h.rgb.a;else{let[a,i,r,n]=v(h.layer,e,t);({r:s,g:o,b:l}=R(a,i,r)),d=n}let c=n?1:Math.min(1,Math.max(0,d*h.alpha));a+=(s-a)*c,i+=(o-i)*c,r+=(l-r)*c,n=!1}return{r:a,g:i,b:r}}}if(s?.color&&!0===s.color.isColor){let{r:e,g:t,b:a}=s.color;return()=>({r:e,g:t,b:a})}return null}var j=32,I=16384,F=32*I,B=100;function W(e,t){if("torus"===e){let e=t()*Math.PI*2,s=t()*Math.PI*2,a=Math.cos(e),i=Math.sin(e),r=Math.cos(s),n=Math.sin(s);return{x:(1.4+.7*r)*a,y:-(1.4+.7*r)*i,z:.7*n,nx:r*a,ny:-r*i,nz:n,cr:1,cg:1,cb:1}}if("cylinder"===e){let e=t()*Math.PI*2,s=Math.cos(e),a=Math.sin(e);return{x:.8*s,y:1.6*(t()-.5),z:.8*a,nx:s,ny:0,nz:a,cr:1,cg:1,cb:1}}let s=t()*Math.PI*2,a=2*t()-1,i=Math.acos(a),r=Math.sin(i)*Math.cos(s),n=Math.cos(i),h=Math.sin(i)*Math.sin(s);return{x:r,y:n,z:h,nx:r,ny:n,nz:h,cr:1,cg:1,cb:1}}function k(e){let{geometry:t,matrix:s}=e,a=t.getAttribute("position");if(!a||a.count<3)return null;let r=t.getAttribute("normal"),n=t.getAttribute("uv"),h=t.getAttribute("color"),o=t.getIndex(),l=o?o.count/3:a.count/3;if(l<1)return null;let d=(e,t)=>o?o.getX(3*e+t):3*e+t,c=s?s.elements:null,u=s?(new i).getNormalMatrix(s).elements:null,g=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[0]*t+c[4]*s+c[8]*i+c[12]:t},p=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[1]*t+c[5]*s+c[9]*i+c[13]:s},b=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[2]*t+c[6]*s+c[10]*i+c[14]:i},S=new Float64Array(l),m=0;for(let e=0;e<l;e++){let t=d(e,0),s=d(e,1),a=d(e,2),i=g(t),r=p(t),n=b(t),h=g(s)-i,o=p(s)-r,l=b(s)-n,c=g(a)-i,u=p(a)-r,f=b(a)-n,M=o*f-l*u,y=l*c-h*f,R=h*u-o*c;m+=.5*Math.sqrt(M*M+y*y+R*R),S[e]=m}return m<=0?null:{total:m,sample:(t,s)=>{let a=0,i=l-1;for(;a<i;){let e=a+i>>1;S[e]<t?a=e+1:i=e}let o=a,c=d(o,0),m=d(o,1),f=d(o,2),M=s(),y=s();M+y>1&&(M=1-M,y=1-y);let R,w,x,v=1-M-y,A=g(c)*v+g(m)*M+g(f)*y,j=p(c)*v+p(m)*M+p(f)*y,I=b(c)*v+b(m)*M+b(f)*y;if(r){if(R=r.getX(c)*v+r.getX(m)*M+r.getX(f)*y,w=r.getY(c)*v+r.getY(m)*M+r.getY(f)*y,x=r.getZ(c)*v+r.getZ(m)*M+r.getZ(f)*y,u){let e=u[0]*R+u[3]*w+u[6]*x,t=u[1]*R+u[4]*w+u[7]*x,s=u[2]*R+u[5]*w+u[8]*x;R=e,w=t,x=s}}else{let e=g(c),t=p(c),s=b(c),a=g(m)-e,i=p(m)-t,r=b(m)-s,n=g(f)-e,h=p(f)-t,o=b(f)-s;R=i*o-r*h,w=r*n-a*o,x=a*h-i*n}let F=Math.sqrt(R*R+w*w+x*x)||1,B=1,W=1,k=1;if(h)B=h.getX(c)*v+h.getX(m)*M+h.getX(f)*y,W=h.getY(c)*v+h.getY(m)*M+h.getY(f)*y,k=h.getZ(c)*v+h.getZ(m)*M+h.getZ(f)*y;else if(e.sampleColor){let t=n?n.getX(c)*v+n.getX(m)*M+n.getX(f)*y:.5,s=n?n.getY(c)*v+n.getY(m)*M+n.getY(f)*y:.5,a=e.sampleColor(t,s);a&&(B=a.r,W=a.g,k=a.b)}return{x:A,y:j,z:I,nx:R/F,ny:w/F,nz:x/F,cr:B,cg:W,cb:k}}}}function H(e){let t=Math.min(Math.max(1,Math.floor(e.guideStrands)),I),s=function(e){let t=e>>>0;return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(e.seed??1337),a="object"===e.shape&&e.sampler,i=a?e.samplerRadius??B:B,r=new Float32Array(4*F),n=new Float32Array(F),h=new Float32Array(4*I).fill(1);for(let o=0;o<t;o++){let t=a?e.sampler(s):W(e.shape,s),l=a?t.x:t.x*i,d=a?t.y:t.y*i,c=a?t.z:t.z*i,{nx:u,ny:g,nz:p}=t;h[4*o+0]=t.cr,h[4*o+1]=t.cg,h[4*o+2]=t.cb;let b,S,m,f=32*o,M=(1.8+.8*s())*e.hairLength*i/31,y=.5+1.5*s(),R=(.02+.06*s())*i;Math.abs(g)<.99?(b=-p,S=0,m=u):(b=1,S=0,m=0);let w=Math.sqrt(b*b+S*S+m*m)||1;for(let e=0;e<32;e++){let t=e/31,s=t*t*.4*i,a=R*Math.sin(t*y*Math.PI*2),h=4*(f+e);r[h+0]=l+u*M*e+a*b/w,r[h+1]=d+g*M*e-s+a*S/w,r[h+2]=c+p*M*e+a*m/w,r[h+3]=0===e?0:1,e<31&&(n[f+e]=M)}}return{initialPositions:r,restLengths:n,unitScale:i,rootColors:h}}var C=1/60,O=4,L=new h,P=new t,z=new s,q=new s,G=class extends e{constructor(e,a,i){super(e,a),this.type="HairSystem",this.isHairSystem=!0,this.simRunning=!1,this.previewRequested=!1,this.playModeActive=!1,this.pendingSimSeconds=0,this.simTime=0,this.resetRequested=!0,this.generation=0,this.settledSimSeconds=0,this.lastMotionFingerprint=0,this.lastBoneQuat=new t,this.lastBonePos=new s,this.hasLastBone=!1,this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,this.classicFallbackWarned=!1,this.regenSnapshot=null,this.context=i,this.data=a,this.geometry.setAttribute("position",new c(new Float32Array(0),3)),this.material=new u({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new g(new l(B,48,32),new u({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let n=new r;n.setAttribute("position",new c(new Float32Array(12),3)),n.setIndex([0,2,1,2,3,1]),n.instanceCount=0,this.ribbonMesh=new g(n,new u({visible:!1})),this.ribbonMesh.name="HairRibbons",this.ribbonMesh.frustumCulled=!1,this.ribbonMesh.visible=!1,this.ribbonMesh.matrixAutoUpdate=!1,this.ribbonMesh.updateMatrixWorld=()=>{this.ribbonMesh.matrixWorld.identity()},this.ribbonMesh.updateWorldMatrix=()=>{this.ribbonMesh.matrixWorld.identity()},this.add(this.ribbonMesh),this.activeGuideStrands=a.guideStrands,this.roots=this.buildRoots(),this.regenSnapshot={guideStrands:a.guideStrands,hairLength:a.hairLength,spreadRadius:a.spreadRadius,headShape:a.headShape,baseObjectId:a.baseObjectId},this.applyScalpState(),this.applyShadowState(),this.syncSimRunning()}update(e){!this.simRunning||(this.pendingSimSeconds=Math.min(this.pendingSimSeconds+e/1e3,4*C*2),this.trackMotionRest(e/1e3))}trackMotionRest(e){this.boneTransform(P,z);let t=this.hasLastBone&&(Math.abs(this.lastBoneQuat.dot(P))<.9999995||this.lastBonePos.distanceToSquared(z)>1e-8),s=this.motionFingerprint(),a=!this.hasLastBone||t||this.resetRequested||s!==this.lastMotionFingerprint||this.data.windStrength>.001;this.lastBoneQuat.copy(P),this.lastBonePos.copy(z),this.lastMotionFingerprint=s,this.hasLastBone=!0,this.settledSimSeconds=a?0:this.settledSimSeconds+e}motionFingerprint(){let e=this.data;return e.gravity+2*e.damping+3*e.localStiffness+4*e.globalStiffness+5*e.globalRange+6*e.stiffnessFalloff+7*e.windStrength+8*e.vspCoefficient+9*e.kink+10*e.kinkFrequency+11*e.clumpStrength+12*e.clumpSize+13*e.clumpTipScale}get isSimulating(){return(this.simRunning||this.resetRequested)&&this.visible}get isMotionSettled(){return this.settledSimSeconds>6}get isVisiblyAnimating(){return this.isSimulating&&!this.isMotionSettled}startPreview(){this.previewRequested=!0,this.syncSimRunning()}stopPreview(){this.previewRequested=!1,this.syncSimRunning()}setPlayMode(e){this.playModeActive=e,e&&this.resetSimulation(),this.syncSimRunning()}resetSimulation(){this.resetRequested=!0,this.pendingSimSeconds=0,this.simTime=0,this.settledSimSeconds=0}warnClassicFallbackOnce(){this.classicFallbackWarned||(this.classicFallbackWarned=!0,console.warn("[spline] Hair System strands require the WebGPU renderer — the WebGL fallback shows only the scalp. Reload with ?renderer=webgpu in a WebGPU-capable browser."))}syncSimRunning(){this.simRunning=this.playModeActive||this.previewRequested||this.data.autoPlay}updateState(e,t){super.updateState(e,t),this.updateHairState(e)}updateHairState(e){if((void 0!==e.guideStrands||void 0!==e.hairLength||void 0!==e.spreadRadius||void 0!==e.headShape||void 0!==e.baseObjectId)&&this.regenerate(),(void 0!==e.headShape||void 0!==e.baseObjectId)&&this.applyScalpState(),void 0!==e.headColor){let t=this.scalpMesh.material;!0===t.isMeshBasicMaterial&&t.color.setRGB(e.headColor.r,e.headColor.g,e.headColor.b,n)}(void 0!==e.castShadow||void 0!==e.receiveShadow)&&this.applyShadowState(),void 0!==e.autoPlay&&this.syncSimRunning()}applyShadowState(){let e=this.data.castShadow??!0,t=this.data.receiveShadow??!0;this.castShadow=e,this.receiveShadow=t,this.scalpMesh.castShadow=e,this.scalpMesh.receiveShadow=t,this.ribbonMesh.castShadow=e,this.ribbonMesh.receiveShadow=t}regenerate(){this.activeGuideStrands=Math.max(1,Math.min(Math.floor(this.data.guideStrands),16384)),this.roots=this.buildRoots(),this.generation++,this.regenSnapshot={guideStrands:this.data.guideStrands,hairLength:this.data.hairLength,spreadRadius:this.data.spreadRadius,headShape:this.data.headShape,baseObjectId:this.data.baseObjectId},this.resetSimulation()}checkDataDrift(){let e=this.data,t=this.regenSnapshot;if(null===t||t.guideStrands!==e.guideStrands||t.hairLength!==e.hairLength||t.spreadRadius!==e.spreadRadius||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId){let s=null===t||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId;this.regenerate(),s&&this.applyScalpState()}this.syncSimRunning(),this.applyShadowState(),this.checkBaseDrift()}buildRoots(){let{headShape:e,baseObjectId:t,guideStrands:s,hairLength:a}=this.data;if(this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,"object"===e&&t){let e=this.context.scene.find(t);if(e){this.baseFoundAtRegen=!0,e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),i=t?function(e){let t=[];for(let s of e){let e=k(s);e&&t.push(e)}if(0===t.length)return null;let s=new Float64Array(t.length),a=0;for(let e=0;e<t.length;e++)a+=t[e].total,s[e]=a;return a<=0?null:e=>{let i=e()*a,r=0,n=t.length-1;for(;r<n;){let e=r+n>>1;s[e]<i?r=e+1:n=e}let h=0===r?i:i-s[r-1];return t[r].sample(h,e)}}(t.sources):null;if(this.baseSourceGeomsAtRegen=t?.sources.map(e=>e.geometry)??[],this.baseSourceHashesAtRegen=t?.hashes??[],this.baseColorHashAtRegen=t?.colorHash??0,t&&i){let r=this.baseWorldScale(e),n=Math.max(t.radius*r,.001);this.baseScaleAtRegen=r;let h=r;return H({shape:"object",guideStrands:s,hairLength:a,sampler:e=>{let t=i(e);return{...t,x:t.x*h,y:t.y*h,z:t.z*h}},samplerRadius:n})}}}return H({shape:"object"===e?"sphere":e,guideStrands:s,hairLength:a})}collectBaseSources(e){let t=[],s=[],a=0,i=0;L.copy(e.matrixWorld).invert();let r=L.clone(),n=o=>{if(!0===o.isHairSystem||o!==e&&!1===o.visible)return;let l=o.geometry;if(!0===o.isMesh&&l&&(l.getAttribute("position")?.count??0)>=3){let n=o===e?void 0:(new h).multiplyMatrices(r,o.matrixWorld),d=Array.isArray(o.material)?o.material[0]:o.material;t.push({geometry:l,matrix:n,sampleColor:A(d,this.context.shared)??void 0}),s.push(G.matrixHash(n)),i+=function(e,t){let s=e,a=0,i=1,r=e=>{a+=e*i,i+=1},n=s?.data?.layers;if(n&&"function"==typeof n.forEach){let e=t;n.forEach(t=>{let s=t.data;if(!1!==s.visible)if("color"===s.type){let t=s.color,a="string"==typeof t?"function"==typeof e?.color?e.color(t):void 0:t;a&&"number"==typeof a.r&&(r(a.r),r(a.g),r(a.b)),r(w(s.alpha,1))}else if("gradient"===s.type){let e=s;for(let t of e.colors??[])r(t[0]),r(t[1]),r(t[2]),r(t[3]);for(let t of e.steps??[])r(t);r(w(e.angle,0)),r(e.gradientType),r(e.smooth?1:0)}})}else s?.color&&!0===s.color.isColor&&(r(s.color.r),r(s.color.g),r(s.color.b));return a}(d,this.context.shared),null===l.boundingSphere&&l.computeBoundingSphere();let c=l.boundingSphere;if(c){let e=0,t=1;n?(z.copy(c.center).applyMatrix4(n),e=z.length(),t=G.matrixMaxScale(n)):e=c.center.length(),a=Math.max(a,e+c.radius*t)}}for(let e of o.children)n(e)};return n(e),0===t.length?null:{sources:t,hashes:s,radius:Math.max(a,.001),colorHash:i}}static matrixHash(e){if(!e)return 0;let t=e.elements,s=0;for(let e=0;e<16;e++)s+=t[e]*(e+1);return s}static matrixMaxScale(e){let t=e.elements,s=Math.hypot(t[0],t[1],t[2]),a=Math.hypot(t[4],t[5],t[6]),i=Math.hypot(t[8],t[9],t[10]);return Math.max(s,a,i,1e-6)}baseWorldScale(e){return L.copy(e.matrixWorld).decompose(z,P,q),Math.max(Math.abs(q.x),Math.abs(q.y),Math.abs(q.z),1e-6)}get widthWorldScale(){return"object"===this.data.headShape&&this.data.baseObjectId&&this.baseScaleAtRegen>0?this.baseScaleAtRegen:1}checkBaseDrift(){if("object"!==this.data.headShape||!this.data.baseObjectId)return;let e=this.context.scene.find(this.data.baseObjectId);if(!e)return;if(!this.baseFoundAtRegen)return void this.regenerate();e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),s=t?.sources??[],a=t?.hashes??[],i=this.baseSourceGeomsAtRegen,r=this.baseSourceHashesAtRegen,n=s.length!==i.length;if(!n)for(let e=0;e<s.length;e++)if(s[e].geometry!==i[e]||Math.abs(a[e]-r[e])>1e-4*Math.max(Math.abs(r[e]),1)){n=!0;break}if(!n&&"object"===this.data.hairColorSource&&(t?.colorHash??0)!==this.baseColorHashAtRegen&&(n=!0),!n&&s.length>0){let t=this.baseWorldScale(e);n=Math.abs(t-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}n&&this.regenerate()}applyScalpState(){let e=this.data.headShape,t="object"===e&&null!==this.data.baseObjectId;this.scalpMesh.visible=!t,!t&&(this.scalpMesh.geometry.dispose(),this.scalpMesh.geometry="torus"===e?new d(140,70,24,48):"cylinder"===e?new a(80,80,160,48,1):new l(B,48,32))}boneTransform(e,t){let s=this.matrixWorld;if("object"===this.data.headShape&&this.data.baseObjectId){let e=this.context.scene.find(this.data.baseObjectId)?.matrixWorld;e&&(s=e)}L.copy(s).decompose(t,e,q)}raycast(e,t){if(!this.scalpMesh.visible)return;let s=[];this.scalpMesh.raycast(e,s);for(let e of s)e.object=this,t.push(e)}get shadowBoundsRadius(){let e="torus"===this.data.headShape?2.6:1.5;return this.roots.unitScale*(e+2.6*Math.max(this.data.hairLength,0))}getShadowBoundsCenter(e){return this.boneTransform(P,e),e}updateEntityBoxSize(e,t){let s=this.shadowBoundsRadius;e.set(0,0,0),t.set(s,s,s)}dispose(){super.dispose(),this.scalpMesh.geometry.dispose(),this.scalpMesh.material.dispose(),this.ribbonMesh.geometry.dispose(),this.ribbonMesh.material.dispose?.(),M()?.release(this)}};export{b as a,S as b,f as c,M as d,j as e,I as f,F as g,B as h,C as i,O as j,G as k};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t,b as e,d as r}from"./runtime-chunk-AKWBEROQ.js";import{g as i}from"./runtime-chunk-4KZXQGUQ.js";import{L as a,za as o}from"./runtime-chunk-RBM3UDQF.js";import{Ae as s,Ec as n,Fc as p,Oc as h,Rc as c,Tc as m,bd as f,dd as u,ud as d,wd as l,we as g,xe as v}from"./runtime-chunk-VGN7YHB7.js";var C=new p,j=new g,T=class extends l{constructor(t){let e=new u,r=new d({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],a=[],o={},s=new m(15711266),n=new m(15711266),p=new m(2857471);function h(t,e,r){c(t,r),c(e,r)}function c(t,e){i.push(0,0,0),a.push(e.r,e.g,e.b),void 0===o[t]&&(o[t]=[]),o[t].push(i.length/3-1)}h("n1","n2",s),h("n2","n4",s),h("n4","n3",s),h("n3","n1",s),h("f1","f2",s),h("f2","f4",s),h("f4","f3",s),h("f3","f1",s),h("n1","f1",s),h("n2","f2",s),h("n3","f3",s),h("n4","f4",s),h("p","n1",n),h("p","n2",n),h("p","n3",n),h("p","n4",n),h("u1","u2",p),h("u2","u3",p),h("u3","u1",p),e.setAttribute("position",new f(i,3)),e.setAttribute("color",new f(a,3)),super(e,r),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){let t=this.geometry,e=this.pointMap;j.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let r=.8;y("n1",e,t,j,-1,-1,r),y("n2",e,t,j,1,-1,r),y("n3",e,t,j,-1,1,r),y("n4",e,t,j,1,1,r);let i=r;y("f1",e,t,j,-1,-1,i),y("f2",e,t,j,1,-1,i),y("f3",e,t,j,-1,1,i),y("f4",e,t,j,1,1,i);let a=i;y("u1",e,t,j,.35,1.1,a),y("u2",e,t,j,-.35,1.1,a),y("u3",e,t,j,0,1.55,a),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function y(t,e,r,i,a,o,s){C.set(a,o,s).unproject(i);let n=e[t];if(void 0!==n){let t=r.getAttribute("position");for(let e=0,r=n.length;e<r;e++)t.setXYZ(n[e],C.x,C.y,C.z)}}var w=class extends(t(T)){constructor(t){super(t),this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,r){e(this.object,this.geometry,t,r,!0)}};function P(t){return 1-Math.pow(1-t,3)}var b=new p,x=new p,_=new n,M=new p,O=new p,F=new p,A=class extends(r(g,w)){constructor(t="",e={...o.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=a.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let t=this._projectionTransition;if(void 0===t)return;if(this.disposed)return void this._endProjectionTransition();t.raf=requestAnimationFrame(this._tickProjectionTransition);let e=A.projectionTransitionRequestRender??t.requestRender;this.updateProjectionMatrix(),e?.()},this.super_Entity(t,e),this.previousProjectionMatrix=new h,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let r=this.width,i=this.height;this.orthoCamera=new s(-.5*r,.5*r,.5*i,-.5*i,-5e4,1e4),this.perspCamera=new v(45,r/i,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(t){let e=A.projectionTransitionsEnabled;A.projectionTransitionsEnabled=!1;try{return t()}finally{A.projectionTransitionsEnabled=e}}get isPerspectiveCamera(){return"PerspectiveCamera"===this.cameraType}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(t){this.perspCamera.fov=t}get fov(){return this.perspCamera.fov}setNear(t,e){"PerspectiveCamera"===t?this.perspCamera.near=e:this.orthoCamera.near=e}setZoom(t,e){e>=0&&("PerspectiveCamera"===t?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}set cameraType(t){"PerspectiveCamera"===t?this.toPerspective():"OrthographicCamera"===t&&this.toOrthographic()}get near(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.near:this.orthoCamera.near}set near(t){"PerspectiveCamera"===this._cameraType?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&("PerspectiveCamera"===this._cameraType?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t,e,r){"number"==typeof t&&(t=new p(t,e,r)),super.lookAt(t),this.getWorldPosition(b),this.targetOffset=b.distanceTo(t)}getTarget(t=new p){return this.getWorldDirection(x),this.getWorldPosition(b),x.multiplyScalar(this.targetOffset),t.copy(b).add(x),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(b),b.distanceTo(t)}updateUp(){this.getWorldQuaternion(_),M.set(0,0,1).applyQuaternion(_),O.copy(c.DEFAULT_UP),this.isUpVectorFlipped&&O.negate(),O.applyQuaternion(_),F.copy(c.DEFAULT_UP).projectOnPlane(M),this.angleOffsetFromUp=F.angleTo(O),this.angleOffsetFromUp*=F.cross(O).dot(M)>=0?1:-1}updateTransformState(t,e){let r=super.updateTransformState(t,e);return void 0!==t.isUpVectorFlipped&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateUp(),r}getViewFrontToObject(t){let e=t.getWorldPosition(new p),r=t.getWorldDirection(new p).multiplyScalar(this.targetOffset);return{position:e.clone().add(r),target:e}}getViewToTarget(t){let e=this.getWorldDirection(new p).multiplyScalar(this.targetOffset);return{position:t.clone().sub(e),target:t}}getViewToObject(t){let e=new p;return t.getWorldPosition(e),this.getViewToTarget(e)}setViewplaneSize(t,e,r=!1){if(this.aspect=t/e,r){let r=t>e?this.aspect:1,i=t>e?1:this.aspect;this.left=-395*r,this.right=395*r,this.top=1/i*395,this.bottom=1/i*-395}else this.left=.5*-t,this.right=.5*t,this.top=.5*e,this.bottom=.5*-e;this.updateProjectionMatrix()}copyViewPlaneSize(t){this.aspect=t.aspect,this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return void 0!==this._projectionTransition}get projectionTransitionProgress(){let t=this._projectionTransition;if(void 0===t)return 1;let e=(performance.now()-t.start)/t.duration;return e>=1?1:e<=0?0:P(e)}get _activeSubCamera(){return"PerspectiveCamera"===this._cameraType?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return A.projectionTransitionsEnabled&&"function"==typeof requestAnimationFrame&&typeof performance<"u"&&performance.now()-this._createdAt>=A.projectionTransitionMinAgeMs}_beginProjectionTransition(t){let e=this._projectionTransition;void 0===e&&(e={from:new h,blend:new h,blendInverse:new h,start:0,duration:A.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:t},this._projectionTransition=e),e.from.copy(this.projectionMatrix),e.start=performance.now(),e.duration=A.projectionTransitionDuration,e.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,t&&(e.requestRender=t),0!==e.raf&&cancelAnimationFrame(e.raf),e.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let t=this._projectionTransition;if(void 0===t)return;let e=(performance.now()-t.start)/t.duration;if(e>=1)return void this._endProjectionTransition();let r=P(e),i=t.from.elements,a=this._activeSubCamera.projectionMatrix.elements,o=t.blend.elements,s=t.referenceDepth,n=Math.max(1e-6,i[15]-i[11]*s),p=r*n/(r*n+(1-r)*Math.max(1e-6,a[15]-a[11]*s));for(let t=0;t<16;t++)o[t]=i[t]+(a[t]-i[t])*p;t.blendInverse.copy(t.blend).invert(),this.projectionMatrix=t.blend,this.projectionMatrixInverse=t.blendInverse}_endProjectionTransition(){let t=this._projectionTransition;if(void 0===t)return;0!==t.raf&&cancelAnimationFrame(t.raf),this._projectionTransition=void 0;let e=this._activeSubCamera;this.projectionMatrix=e.projectionMatrix,this.projectionMatrixInverse=e.projectionMatrixInverse}_syncProjectionTransition(t){let e=t._projectionTransition;if(void 0===e)return void(void 0!==this._projectionTransition&&this._endProjectionTransition());let r=this._projectionTransition;void 0===r?(r={from:new h,blend:new h,blendInverse:new h,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=r):0!==r.raf&&(cancelAnimationFrame(r.raf),r.raf=0),r.requestRender=void 0,r.from.copy(e.from),r.start=e.start,r.duration=e.duration,r.referenceDepth=e.referenceDepth,this._applyProjectionTransition()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,e,r,i,a,o){"PerspectiveCamera"===this._cameraType?this.perspCamera.setViewOffset(t,e,r,i,a,o):this.orthoCamera.setViewOffset(t,e,r,i,a,o),this._applyProjectionTransition()}clearViewOffset(){"PerspectiveCamera"===this._cameraType?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){"PerspectiveCamera"===this._cameraType?this.toPerspective():"OrthographicCamera"===this._cameraType&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,e){return super.copy(t,e),this.parent=t.parent,this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=null===t.view?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=a.sanitizeTargetOffset(t.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(t),this}toCameraState(t=[]){let e={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return i(e,t)}updateCameraSubtype(t,e){let r="perspective"===t?"PerspectiveCamera":"OrthographicCamera";void 0!==e.zoom&&this.setZoom(r,e.zoom),void 0!==e.near&&this.setNear(r,e.near),void 0!==e.fov&&"PerspectiveCamera"===r&&(this.fov=e.fov)}updateState(t,e){this.updateCameraState(t,e)}updateCameraState(t,e){this.updateState_Entity(t,e),void 0!==t.far&&(this.far=t.far),void 0!==t.orthographic&&this.updateCameraSubtype("orthographic",t.orthographic),void 0!==t.perspective&&this.updateCameraSubtype("perspective",t.perspective),void 0!==t.type&&(t.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(e?.shared.requestRender),this.cameraType=t.type),void 0!==t.up&&this.up.fromArray(t.up.map(t=>"number"==typeof t?t:0)),void 0!==t.targetOffset&&(this.targetOffset=a.sanitizeTargetOffset(t.targetOffset)),void 0!==t.isUpVectorFlipped&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(t,e,r){super.updateByPatchedOp(t,e,r),1===t.path.length&&0===t.type&&this.updateCameraSubtype(t.path[0],t.props)}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}},U=A;U.projectionTransitionsEnabled=!1,U.projectionTransitionDuration=350,U.projectionTransitionMinAgeMs=1e3;export{U as a};
|
|
1
|
+
import{a as t,b as e,d as r}from"./runtime-chunk-AELTGHV2.js";import{g as i}from"./runtime-chunk-4KZXQGUQ.js";import{L as a,za as o}from"./runtime-chunk-VPEJ5BFD.js";import{Ae as s,Ec as n,Fc as p,Oc as h,Rc as c,Tc as m,bd as f,dd as u,ud as d,wd as l,we as g,xe as v}from"./runtime-chunk-VGN7YHB7.js";var C=new p,j=new g,T=class extends l{constructor(t){let e=new u,r=new d({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],a=[],o={},s=new m(15711266),n=new m(15711266),p=new m(2857471);function h(t,e,r){c(t,r),c(e,r)}function c(t,e){i.push(0,0,0),a.push(e.r,e.g,e.b),void 0===o[t]&&(o[t]=[]),o[t].push(i.length/3-1)}h("n1","n2",s),h("n2","n4",s),h("n4","n3",s),h("n3","n1",s),h("f1","f2",s),h("f2","f4",s),h("f4","f3",s),h("f3","f1",s),h("n1","f1",s),h("n2","f2",s),h("n3","f3",s),h("n4","f4",s),h("p","n1",n),h("p","n2",n),h("p","n3",n),h("p","n4",n),h("u1","u2",p),h("u2","u3",p),h("u3","u1",p),e.setAttribute("position",new f(i,3)),e.setAttribute("color",new f(a,3)),super(e,r),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){let t=this.geometry,e=this.pointMap;j.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let r=.8;y("n1",e,t,j,-1,-1,r),y("n2",e,t,j,1,-1,r),y("n3",e,t,j,-1,1,r),y("n4",e,t,j,1,1,r);let i=r;y("f1",e,t,j,-1,-1,i),y("f2",e,t,j,1,-1,i),y("f3",e,t,j,-1,1,i),y("f4",e,t,j,1,1,i);let a=i;y("u1",e,t,j,.35,1.1,a),y("u2",e,t,j,-.35,1.1,a),y("u3",e,t,j,0,1.55,a),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function y(t,e,r,i,a,o,s){C.set(a,o,s).unproject(i);let n=e[t];if(void 0!==n){let t=r.getAttribute("position");for(let e=0,r=n.length;e<r;e++)t.setXYZ(n[e],C.x,C.y,C.z)}}var w=class extends(t(T)){constructor(t){super(t),this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,r){e(this.object,this.geometry,t,r,!0)}};function P(t){return 1-Math.pow(1-t,3)}var b=new p,x=new p,_=new n,M=new p,O=new p,F=new p,A=class extends(r(g,w)){constructor(t="",e={...o.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=a.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let t=this._projectionTransition;if(void 0===t)return;if(this.disposed)return void this._endProjectionTransition();t.raf=requestAnimationFrame(this._tickProjectionTransition);let e=A.projectionTransitionRequestRender??t.requestRender;this.updateProjectionMatrix(),e?.()},this.super_Entity(t,e),this.previousProjectionMatrix=new h,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let r=this.width,i=this.height;this.orthoCamera=new s(-.5*r,.5*r,.5*i,-.5*i,-5e4,1e4),this.perspCamera=new v(45,r/i,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(t){let e=A.projectionTransitionsEnabled;A.projectionTransitionsEnabled=!1;try{return t()}finally{A.projectionTransitionsEnabled=e}}get isPerspectiveCamera(){return"PerspectiveCamera"===this.cameraType}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(t){this.perspCamera.fov=t}get fov(){return this.perspCamera.fov}setNear(t,e){"PerspectiveCamera"===t?this.perspCamera.near=e:this.orthoCamera.near=e}setZoom(t,e){e>=0&&("PerspectiveCamera"===t?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}set cameraType(t){"PerspectiveCamera"===t?this.toPerspective():"OrthographicCamera"===t&&this.toOrthographic()}get near(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.near:this.orthoCamera.near}set near(t){"PerspectiveCamera"===this._cameraType?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&("PerspectiveCamera"===this._cameraType?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t,e,r){"number"==typeof t&&(t=new p(t,e,r)),super.lookAt(t),this.getWorldPosition(b),this.targetOffset=b.distanceTo(t)}getTarget(t=new p){return this.getWorldDirection(x),this.getWorldPosition(b),x.multiplyScalar(this.targetOffset),t.copy(b).add(x),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(b),b.distanceTo(t)}updateUp(){this.getWorldQuaternion(_),M.set(0,0,1).applyQuaternion(_),O.copy(c.DEFAULT_UP),this.isUpVectorFlipped&&O.negate(),O.applyQuaternion(_),F.copy(c.DEFAULT_UP).projectOnPlane(M),this.angleOffsetFromUp=F.angleTo(O),this.angleOffsetFromUp*=F.cross(O).dot(M)>=0?1:-1}updateTransformState(t,e){let r=super.updateTransformState(t,e);return void 0!==t.isUpVectorFlipped&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateUp(),r}getViewFrontToObject(t){let e=t.getWorldPosition(new p),r=t.getWorldDirection(new p).multiplyScalar(this.targetOffset);return{position:e.clone().add(r),target:e}}getViewToTarget(t){let e=this.getWorldDirection(new p).multiplyScalar(this.targetOffset);return{position:t.clone().sub(e),target:t}}getViewToObject(t){let e=new p;return t.getWorldPosition(e),this.getViewToTarget(e)}setViewplaneSize(t,e,r=!1){if(this.aspect=t/e,r){let r=t>e?this.aspect:1,i=t>e?1:this.aspect;this.left=-395*r,this.right=395*r,this.top=1/i*395,this.bottom=1/i*-395}else this.left=.5*-t,this.right=.5*t,this.top=.5*e,this.bottom=.5*-e;this.updateProjectionMatrix()}copyViewPlaneSize(t){this.aspect=t.aspect,this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return void 0!==this._projectionTransition}get projectionTransitionProgress(){let t=this._projectionTransition;if(void 0===t)return 1;let e=(performance.now()-t.start)/t.duration;return e>=1?1:e<=0?0:P(e)}get _activeSubCamera(){return"PerspectiveCamera"===this._cameraType?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return A.projectionTransitionsEnabled&&"function"==typeof requestAnimationFrame&&typeof performance<"u"&&performance.now()-this._createdAt>=A.projectionTransitionMinAgeMs}_beginProjectionTransition(t){let e=this._projectionTransition;void 0===e&&(e={from:new h,blend:new h,blendInverse:new h,start:0,duration:A.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:t},this._projectionTransition=e),e.from.copy(this.projectionMatrix),e.start=performance.now(),e.duration=A.projectionTransitionDuration,e.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,t&&(e.requestRender=t),0!==e.raf&&cancelAnimationFrame(e.raf),e.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let t=this._projectionTransition;if(void 0===t)return;let e=(performance.now()-t.start)/t.duration;if(e>=1)return void this._endProjectionTransition();let r=P(e),i=t.from.elements,a=this._activeSubCamera.projectionMatrix.elements,o=t.blend.elements,s=t.referenceDepth,n=Math.max(1e-6,i[15]-i[11]*s),p=r*n/(r*n+(1-r)*Math.max(1e-6,a[15]-a[11]*s));for(let t=0;t<16;t++)o[t]=i[t]+(a[t]-i[t])*p;t.blendInverse.copy(t.blend).invert(),this.projectionMatrix=t.blend,this.projectionMatrixInverse=t.blendInverse}_endProjectionTransition(){let t=this._projectionTransition;if(void 0===t)return;0!==t.raf&&cancelAnimationFrame(t.raf),this._projectionTransition=void 0;let e=this._activeSubCamera;this.projectionMatrix=e.projectionMatrix,this.projectionMatrixInverse=e.projectionMatrixInverse}_syncProjectionTransition(t){let e=t._projectionTransition;if(void 0===e)return void(void 0!==this._projectionTransition&&this._endProjectionTransition());let r=this._projectionTransition;void 0===r?(r={from:new h,blend:new h,blendInverse:new h,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=r):0!==r.raf&&(cancelAnimationFrame(r.raf),r.raf=0),r.requestRender=void 0,r.from.copy(e.from),r.start=e.start,r.duration=e.duration,r.referenceDepth=e.referenceDepth,this._applyProjectionTransition()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,e,r,i,a,o){"PerspectiveCamera"===this._cameraType?this.perspCamera.setViewOffset(t,e,r,i,a,o):this.orthoCamera.setViewOffset(t,e,r,i,a,o),this._applyProjectionTransition()}clearViewOffset(){"PerspectiveCamera"===this._cameraType?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){"PerspectiveCamera"===this._cameraType?this.toPerspective():"OrthographicCamera"===this._cameraType&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,e){return super.copy(t,e),this.parent=t.parent,this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=null===t.view?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=a.sanitizeTargetOffset(t.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(t),this}toCameraState(t=[]){let e={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return i(e,t)}updateCameraSubtype(t,e){let r="perspective"===t?"PerspectiveCamera":"OrthographicCamera";void 0!==e.zoom&&this.setZoom(r,e.zoom),void 0!==e.near&&this.setNear(r,e.near),void 0!==e.fov&&"PerspectiveCamera"===r&&(this.fov=e.fov)}updateState(t,e){this.updateCameraState(t,e)}updateCameraState(t,e){this.updateState_Entity(t,e),void 0!==t.far&&(this.far=t.far),void 0!==t.orthographic&&this.updateCameraSubtype("orthographic",t.orthographic),void 0!==t.perspective&&this.updateCameraSubtype("perspective",t.perspective),void 0!==t.type&&(t.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(e?.shared.requestRender),this.cameraType=t.type),void 0!==t.up&&this.up.fromArray(t.up.map(t=>"number"==typeof t?t:0)),void 0!==t.targetOffset&&(this.targetOffset=a.sanitizeTargetOffset(t.targetOffset)),void 0!==t.isUpVectorFlipped&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(t,e,r){super.updateByPatchedOp(t,e,r),1===t.path.length&&0===t.type&&this.updateCameraSubtype(t.path[0],t.props)}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}},V=A;V.projectionTransitionsEnabled=!1,V.projectionTransitionDuration=350,V.projectionTransitionMinAgeMs=1e3;export{V as a};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as t,j as e,k as i}from"./runtime-chunk-
|
|
1
|
+
import{h as t,j as e,k as i}from"./runtime-chunk-OUXEWX5Z.js";import{a as s}from"./runtime-chunk-R43XZP65.js";import{a}from"./runtime-chunk-32KZP4YN.js";import{e as n}from"./runtime-chunk-EPHVY3XO.js";import{e as r}from"./runtime-chunk-2PT2WH66.js";import{q as o}from"./runtime-chunk-VPEJ5BFD.js";import{Bc as h}from"./runtime-chunk-VGN7YHB7.js";var d=class extends h{constructor(t,e,i,s,a){if(super(),this.eventType=t,this.data=e,this.page=i,this.shared=s,this.condition=a,this.toggleIsForward=!1,this.timelineNeedsRebuild=!1,this.hasPlayedOnce=!1,this.pauseOnNextLoopEnd=!1,this.onTimelineChangeComplete=()=>{if(this.pauseOnNextLoopEnd)return this.pauseOnNextLoopEnd=!1,void this.timeline?.pause();"normal"!==this.data.tweens[0].data.direction&&(this.toggleIsForward=!this.toggleIsForward),!1!==this.timelineNeedsRebuild&&(this.timeline?.pause(),this.buildTimeline({isForward:this.toggleIsForward,needsRebuild:!1,isRebuild:!0}),this.timeline.play())},!e.object)throw new Error("Missing property");let n=this.page.scene.find(e.object)??this.page.uiCanvas?.find(e.object)??this.page.scene.find2DInUIObjects(e.object);if(!n)throw new Error("Missing property");if(!n.states)throw new Error("Missing property");if(this.object=n,e.tweens.length<2)throw new Error("Missing property");this.tweens=Array(this.data.tweens.length-1),this.startOnceDelay="start-once"===e.tweens[0].data.delayDirection?e.tweens[0].data.delay:0,this.init()}get playing(){return!1===this.timeline?.paused}get changeBegan(){return this.tweens.some(t=>t.changeBegan)??!1}init(){this.initialCurrentState=e(this.object,this.object.currentState).id,this.toggleIsForward=!1}get currentState(){return"Toggle"===this.data.runMode&&o(this.eventType)?this.initialCurrentState:this.object.currentState}buildTimeline({isForward:e=!0,needsRebuild:n=!1,isRebuild:r=!1}={}){try{let o=t(this.data.tweens[0].data);r&&"number"==typeof o.loop&&o.loop--,this.timeline?.pause(),this.timeline=s.timeline({autoplay:!1,...o,...!0===o.loop||o.loop>1?{timelineChangeComplete:this.onTimelineChangeComplete}:{}});let h=this.tweens.findIndex(t=>t?.changeBegan);if(!0===n&&(this.timelineNeedsRebuild=!0),e){let t=-1===h?0:h;for(let e=t;e<this.data.tweens.length-1;e++){let s,n=this.data.tweens[e],r=this.data.tweens[e+1];e!==t||!0!==this.object.wasMovedByUser&&!0!==this.object.previousAction?.changeBegan?s=void 0===n.data.state?this.currentState:n.data.state:(s=void 0,this.object instanceof a&&(this.object.wasMovedByUser=!1));let d=new i(this.object,s,void 0===r.data.state?this.currentState:r.data.state,r.data,this.shared,this.data.allowSlerp??!1,this.page);-1!==h&&e===t&&Object.assign(d.params,{startOnceDelay:0}),this.tweens[e]=d,this.timeline.add(d.params,this.timeline.duration+(e===t?o.delay:0))}this.timeline.duration+=o.endDelay}else{let t=-1===h?this.data.tweens.length-1:h+1;for(let e=t;e>0;e--){let s,n=this.data.tweens[e],r=this.data.tweens[e-1];e!==t||!0!==this.object.wasMovedByUser&&!0!==this.object.previousAction?.changeBegan?s=void 0===n.data.state?this.currentState:n.data.state:(s=void 0,this.object instanceof a&&(this.object.wasMovedByUser=!1));let d=new i(this.object,s,void 0===r.data.state?this.currentState:r.data.state,n.data,this.shared,this.data.allowSlerp??!1,this.page);-1!==h&&e===t&&Object.assign(d.params,{startOnceDelay:0}),this.tweens[e-1]=d,this.timeline.add(d.params,this.timeline.duration+(e===t?o.endDelay:0))}this.timeline.duration+=o.delay}}catch(t){t instanceof Error&&console.error(t.message)}!0===this.object.previousAction?.playing&&this.object.previousAction.pause(),this.object.previousAction=this}play(){if(!1===n(this.shared,this.condition)||o(this.eventType)&&"Once"===this.data.runMode&&this.hasPlayedOnce||(this.hasPlayedOnce=!0,this.playing))return!1;this.startTimeout?.pause();let e=t(this.data.tweens[0].data).pingPongDelayCorrection;this.startTimeout=s({targets:{},duration:this.startOnceDelay+e,easing:"linear",complete:()=>{this.startTimeout=void 0;try{this.buildTimeline(),this.timeline.play()}catch(t){t instanceof Error&&console.error(t.message)}}})}pause(){this.timeline?.pause(),this.startTimeout?.pause(),this.tweens=Array(this.data.tweens.length-1),delete this.startTimeout}stop(){this.pause();let t=void 0===this.data.tweens[0].data.state?this.initialCurrentState:this.data.tweens[0].data.state;r(this.object)?this.object.changeSelectedState(t,{shared:this.shared}):this.object.changeSelectedState(t,{scene:this.page.scene,shared:this.shared}),this.object.currentState=t}seek(t){if(!1===n(this.shared,this.condition))return!1;void 0===this.timeline&&this.buildTimeline(),this.timeline?.seek(t*this.timeline.duration,!0)}toggle(t){if(!1===n(this.shared,this.condition))return!1;this.startTimeout?.pause(),this.toggleIsForward=t??!this.toggleIsForward,this.playing?(this.timeline?.pause(),this.buildTimeline({isForward:this.toggleIsForward,needsRebuild:!0}),this.pauseOnNextLoopEnd=!0,this.timeline.play()):this.startTimeout=s({targets:{},duration:this.startOnceDelay,easing:"linear",complete:()=>{this.startTimeout=void 0,this.timeline?.pause(),this.buildTimeline({isForward:this.toggleIsForward}),this.timeline.play()}})}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause()}};export{d as a};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./runtime-chunk-
|
|
1
|
+
import{a as e}from"./runtime-chunk-32KZP4YN.js";import{ea as t}from"./runtime-chunk-DK66VKWP.js";import{h as a}from"./runtime-chunk-CKT62HES.js";import{c as s,e as o,f as i}from"./runtime-chunk-2PT2WH66.js";import{b as r}from"./runtime-chunk-U4QOT2PX.js";import{Ea as n,w as d}from"./runtime-chunk-VPEJ5BFD.js";import{Fc as c}from"./runtime-chunk-VGN7YHB7.js";var l=new c;function u(e,t,s=!1){let o=[],c=a=>{let s=a.data;delete a.states,a.currentState=null,a.reversibleToState=null,a.currentTransitionEvent=null;for(let e of s.states){let t={...e.data};a.states||(a.states={}),a.states[e.id]=r.patch(s,t)}p(e.scene,a,null,t,void 0!==s.events.find(e=>"Follow"===e.data.type||"LookAt"===e.data.type)),f(e)};e.scene.traverse2D(c),e.traverseChildren(r=>{if(s&&(r.rigidBody?.setTranslation(r.position0,!0),r.rigidBody?.setRotation(r.rotation0,!0),r.rigidBody?.setLinvel(l,!0),r.rigidBody?.setAngvel(l,!0)),!a.is(r))return;let u=r.uuid,f=r.data;if(delete r.states,r.uuid===d)return;let m=!1;o.some(t=>e.scene.find(u)?.isDescendantOf(t))?m=!0:!0===f.physics?.fusedBody&&"dynamic"===f.physics.rigidBody&&o.push(u),r.data=f,r.currentState=null,r.reversibleToState=null,r.currentTransitionEvent=null;for(let t of f.states){let a={...t.data};!0===e.data.globalPhysics.usePhysics&&f.physics&&("dynamic"===f.physics.rigidBody||m)&&(void 0!==t.data.position&&delete a.position,void 0!==t.data.rotation&&delete a.rotation,void 0!==t.data.hiddenMatrix&&delete a.hiddenMatrix),r.states||(r.states={}),r.states[t.id]=n.patch(f,a)}p(e.scene,r,null,t,void 0!==f.events.find(e=>"Follow"===e.data.type||"LookAt"===e.data.type)),i(r)&&r.frame&&(r.frame.traverse(e=>c(e)),r.uiCanvas?.applySize())}),f(e),e.frame&&(e.frame.traverse(e=>c(e)),e.uiCanvas?.applySize())}function f(e){e.traverseEntity(t=>{for(let a of t.data.events){let t=[];switch(a.data.type){case"Follow":case"MouseHover":case"Scroll":case"MouseDown":case"MouseUp":case"MousePress":case"KeyUp":case"KeyDown":case"KeyPress":case"Collision":t.push(...a.data.actions);break;case"GameControl":for(let e of Object.values(a.data.gameActions))t.push(...e);break;case"DragDrop":t.push(...a.data.dragDropActions.drag,...a.data.dragDropActions.drop);break;case"Conditional":t.push(...a.data.inActions,...a.data.outActions)}for(let a of t)if("Create"===a.data.type&&"Yes"===a.data.hideBase){let t=e.scene.find(a.data.object);t&&(t.visible=!1)}}})}function p(a,i,r,n,d=!1){if(a.markShadowsDirty(),i instanceof t&&!s(i)&&i.removeInteractionGeometry(n),o(i)?i.changeSelectedState(r,{shared:n},d):i.changeSelectedState(r,{scene:a,shared:n},d),i instanceof t&&i.updateGeometryGroupsIfNeeded(),i instanceof e&&i.updateCameraState(i.dataPatched,{scene:a,shared:n}),!o(i)){if(i.cloner){let e=!1;for(let t of i.cloner.children)t.playModeVisible=void 0,void 0!==t.transformOverride&&(t.transformOverride=void 0,e=!0);e&&a.addPendingUpdateCloner(i),i.cloner.syncInstanceMatrices()}i.updateVisible()}}export{u as a};
|
|
Binary file
|