@splinetool/runtime 2.0.158 → 2.0.160
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 +56 -31
- 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-bloom-WOKMPZUM.js → runtime-bloom-BCIKZBEA.js} +1 -1
- package/build/runtime-bloom-BCIKZBEA.js.br +0 -0
- package/build/runtime-bloom-BCIKZBEA.js.gz +0 -0
- package/build/{runtime-brightnessContrast-LAZS3J44.js → runtime-brightnessContrast-4RZUU364.js} +1 -1
- package/build/runtime-brightnessContrast-4RZUU364.js.br +0 -0
- package/build/runtime-brightnessContrast-4RZUU364.js.gz +0 -0
- package/build/{runtime-chromaticAberration-CJUJB3XW.js → runtime-chromaticAberration-3RHGUSI4.js} +1 -1
- package/build/runtime-chromaticAberration-3RHGUSI4.js.br +0 -0
- package/build/runtime-chromaticAberration-3RHGUSI4.js.gz +0 -0
- package/build/{runtime-chunk-67G2KTJJ.js → runtime-chunk-244LC6MP.js} +1 -1
- package/build/runtime-chunk-244LC6MP.js.br +1 -0
- package/build/runtime-chunk-244LC6MP.js.gz +0 -0
- package/build/{runtime-chunk-3FGLYFO7.js → runtime-chunk-67JVRH4T.js} +1 -1
- package/build/runtime-chunk-67JVRH4T.js.br +0 -0
- package/build/runtime-chunk-67JVRH4T.js.gz +0 -0
- package/build/{runtime-chunk-MJECPN22.js → runtime-chunk-7B2VPZYM.js} +1 -1
- package/build/runtime-chunk-7B2VPZYM.js.br +0 -0
- package/build/runtime-chunk-7B2VPZYM.js.gz +0 -0
- package/build/{runtime-chunk-PLP3UUOR.js → runtime-chunk-AHZ2EI5H.js} +1 -1
- package/build/runtime-chunk-AHZ2EI5H.js.br +0 -0
- package/build/runtime-chunk-AHZ2EI5H.js.gz +0 -0
- package/build/{runtime-chunk-KL4O2RLK.js → runtime-chunk-APVHFUEV.js} +1 -1
- package/build/runtime-chunk-APVHFUEV.js.br +0 -0
- package/build/runtime-chunk-APVHFUEV.js.gz +0 -0
- package/build/{runtime-chunk-EBOREXNC.js → runtime-chunk-B746A6R3.js} +1 -1
- package/build/runtime-chunk-B746A6R3.js.br +0 -0
- package/build/runtime-chunk-B746A6R3.js.gz +0 -0
- package/build/{runtime-chunk-HVKLVHUH.js → runtime-chunk-BOUH46YB.js} +1 -1
- package/build/runtime-chunk-BOUH46YB.js.br +0 -0
- package/build/runtime-chunk-BOUH46YB.js.gz +0 -0
- package/build/{runtime-chunk-F24NJYFN.js → runtime-chunk-C2CAU2UD.js} +1 -1
- package/build/runtime-chunk-C2CAU2UD.js.br +0 -0
- package/build/runtime-chunk-C2CAU2UD.js.gz +0 -0
- package/build/{runtime-chunk-MV7E3X22.js → runtime-chunk-CYRTVQZD.js} +1 -1
- package/build/runtime-chunk-CYRTVQZD.js.br +0 -0
- package/build/runtime-chunk-CYRTVQZD.js.gz +0 -0
- package/build/{runtime-chunk-KMB4DZ4J.js → runtime-chunk-DGTIMU6T.js} +1 -1
- package/build/runtime-chunk-DGTIMU6T.js.br +0 -0
- package/build/runtime-chunk-DGTIMU6T.js.gz +0 -0
- package/build/{runtime-chunk-H324TMOT.js → runtime-chunk-DL4A3K5P.js} +1 -1
- package/build/runtime-chunk-DL4A3K5P.js.br +0 -0
- package/build/runtime-chunk-DL4A3K5P.js.gz +0 -0
- package/build/{runtime-chunk-JGCLZ3Q7.js → runtime-chunk-FAV6G64D.js} +1 -1
- package/build/runtime-chunk-FAV6G64D.js.br +0 -0
- package/build/runtime-chunk-FAV6G64D.js.gz +0 -0
- package/build/{runtime-chunk-UPR6SP3E.js → runtime-chunk-GFMUAGIR.js} +1 -1
- package/build/runtime-chunk-GFMUAGIR.js.br +0 -0
- package/build/runtime-chunk-GFMUAGIR.js.gz +0 -0
- package/build/{runtime-chunk-URBZFWAL.js → runtime-chunk-I3KZIMEW.js} +1 -1
- package/build/runtime-chunk-I3KZIMEW.js.br +0 -0
- package/build/runtime-chunk-I3KZIMEW.js.gz +0 -0
- package/build/{runtime-chunk-EIVMD3A7.js → runtime-chunk-KAPSF5TL.js} +1 -1
- package/build/runtime-chunk-KAPSF5TL.js.br +0 -0
- package/build/runtime-chunk-KAPSF5TL.js.gz +0 -0
- package/build/{runtime-chunk-2BIYUOHJ.js → runtime-chunk-O2KHHZMS.js} +1 -1
- package/build/runtime-chunk-O2KHHZMS.js.br +0 -0
- package/build/runtime-chunk-O2KHHZMS.js.gz +0 -0
- package/build/{runtime-chunk-JA5SKCPM.js → runtime-chunk-OZLC437Q.js} +1 -1
- package/build/{runtime-chunk-JA5SKCPM.js.br → runtime-chunk-OZLC437Q.js.br} +0 -0
- package/build/runtime-chunk-OZLC437Q.js.gz +0 -0
- package/build/{runtime-chunk-CWGKGTX3.js → runtime-chunk-POOKT2FW.js} +1 -1
- package/build/runtime-chunk-POOKT2FW.js.br +0 -0
- package/build/runtime-chunk-POOKT2FW.js.gz +0 -0
- package/build/{runtime-chunk-GEXOF3N3.js → runtime-chunk-RYJNVDUM.js} +1 -1
- package/build/runtime-chunk-RYJNVDUM.js.br +0 -0
- package/build/runtime-chunk-RYJNVDUM.js.gz +0 -0
- package/build/{runtime-chunk-X5WK4QEQ.js → runtime-chunk-T2V3VIUH.js} +1 -1
- package/build/runtime-chunk-T2V3VIUH.js.br +0 -0
- package/build/runtime-chunk-T2V3VIUH.js.gz +0 -0
- package/build/{runtime-chunk-7ECXYPPU.js → runtime-chunk-TDGCV24Q.js} +1 -1
- package/build/runtime-chunk-TDGCV24Q.js.br +0 -0
- package/build/runtime-chunk-TDGCV24Q.js.gz +0 -0
- package/build/{runtime-chunk-AIQFMDVO.js → runtime-chunk-TFVTJVME.js} +1 -1
- package/build/runtime-chunk-TFVTJVME.js.br +0 -0
- package/build/runtime-chunk-TFVTJVME.js.gz +0 -0
- package/build/{runtime-chunk-VNBKDSM2.js → runtime-chunk-UEKUXDLG.js} +1 -1
- package/build/runtime-chunk-UEKUXDLG.js.br +0 -0
- package/build/runtime-chunk-UEKUXDLG.js.gz +0 -0
- package/build/{runtime-chunk-26SNIBGW.js → runtime-chunk-UQM7NEPK.js} +1 -1
- package/build/runtime-chunk-UQM7NEPK.js.br +0 -0
- package/build/runtime-chunk-UQM7NEPK.js.gz +0 -0
- package/build/{runtime-chunk-HOAMYWLP.js → runtime-chunk-WJPI7EAI.js} +1 -1
- package/build/runtime-chunk-WJPI7EAI.js.br +0 -0
- package/build/runtime-chunk-WJPI7EAI.js.gz +0 -0
- package/build/{runtime-chunk-DULMKDNI.js → runtime-chunk-XBG5ROFH.js} +1 -1
- package/build/runtime-chunk-XBG5ROFH.js.br +0 -0
- package/build/runtime-chunk-XBG5ROFH.js.gz +0 -0
- package/build/{runtime-chunk-IMVM7XG3.js → runtime-chunk-ZBHADU7F.js} +1 -1
- package/build/runtime-chunk-ZBHADU7F.js.br +0 -0
- package/build/runtime-chunk-ZBHADU7F.js.gz +0 -0
- package/build/{runtime-classicRuntime-JUADSMET.js → runtime-classicRuntime-7UEL6B3U.js} +1 -1
- package/build/runtime-classicRuntime-7UEL6B3U.js.br +0 -0
- package/build/runtime-classicRuntime-7UEL6B3U.js.gz +0 -0
- package/build/{runtime-cloners-CFYV6RIB.js → runtime-cloners-IV5JEXST.js} +1 -1
- package/build/runtime-cloners-IV5JEXST.js.br +0 -0
- package/build/runtime-cloners-IV5JEXST.js.gz +0 -0
- package/build/{runtime-components-73ZVG55O.js → runtime-components-ABF4V6NS.js} +1 -1
- package/build/runtime-components-ABF4V6NS.js.br +0 -0
- package/build/runtime-components-ABF4V6NS.js.gz +0 -0
- package/build/{runtime-createDestroy-JB4TBG77.js → runtime-createDestroy-ZXW22GR2.js} +1 -1
- package/build/runtime-createDestroy-ZXW22GR2.js.br +0 -0
- package/build/runtime-createDestroy-ZXW22GR2.js.gz +0 -0
- package/build/{runtime-depthOfField-G5EQM2NS.js → runtime-depthOfField-CMLWIQFI.js} +1 -1
- package/build/runtime-depthOfField-CMLWIQFI.js.br +0 -0
- package/build/runtime-depthOfField-CMLWIQFI.js.gz +0 -0
- package/build/{runtime-dragDrop-7AKEX5AU.js → runtime-dragDrop-YWEZOTXF.js} +1 -1
- package/build/runtime-dragDrop-YWEZOTXF.js.br +0 -0
- package/build/runtime-dragDrop-YWEZOTXF.js.gz +0 -0
- package/build/{runtime-gameControls-LE4EHTAX.js → runtime-gameControls-AHOA36GR.js} +1 -1
- package/build/runtime-gameControls-AHOA36GR.js.br +0 -0
- package/build/runtime-gameControls-AHOA36GR.js.gz +0 -0
- package/build/{runtime-hair-LM7K7ULP.js → runtime-hair-6WVY27RG.js} +1 -1
- package/build/runtime-hair-6WVY27RG.js.br +2 -0
- package/build/runtime-hair-6WVY27RG.js.gz +0 -0
- package/build/{runtime-hueSaturation-YLCXCGRL.js → runtime-hueSaturation-EW54YMQI.js} +1 -1
- package/build/runtime-hueSaturation-EW54YMQI.js.br +0 -0
- package/build/runtime-hueSaturation-EW54YMQI.js.gz +0 -0
- package/build/{runtime-mergeStaticGeometries-INGAUYKH.js → runtime-mergeStaticGeometries-DUF2ZBXY.js} +1 -1
- package/build/runtime-mergeStaticGeometries-DUF2ZBXY.js.br +0 -0
- package/build/runtime-mergeStaticGeometries-DUF2ZBXY.js.gz +0 -0
- package/build/{runtime-miscActions-CHS3673K.js → runtime-miscActions-R35TOHOE.js} +1 -1
- package/build/runtime-miscActions-R35TOHOE.js.br +0 -0
- package/build/runtime-miscActions-R35TOHOE.js.gz +0 -0
- package/build/{runtime-mouseHover-PUKVQX75.js → runtime-mouseHover-5TKLUE6P.js} +1 -1
- package/build/runtime-mouseHover-5TKLUE6P.js.br +0 -0
- package/build/runtime-mouseHover-5TKLUE6P.js.gz +0 -0
- package/build/{runtime-noise-SMSEQDWF.js → runtime-noise-7B3N6OON.js} +1 -1
- package/build/runtime-noise-7B3N6OON.js.br +0 -0
- package/build/runtime-noise-7B3N6OON.js.gz +0 -0
- package/build/{runtime-particles-YC55LAZE.js → runtime-particles-Z4L6HZL7.js} +1 -1
- package/build/runtime-particles-Z4L6HZL7.js.br +0 -0
- package/build/runtime-particles-Z4L6HZL7.js.gz +0 -0
- package/build/{runtime-paths-JH72VUYH.js → runtime-paths-OB53G53L.js} +1 -1
- package/build/runtime-paths-OB53G53L.js.br +0 -0
- package/build/runtime-paths-OB53G53L.js.gz +0 -0
- package/build/{runtime-pixelation-IXZLOD7E.js → runtime-pixelation-TZDENYAX.js} +1 -1
- package/build/runtime-pixelation-TZDENYAX.js.br +0 -0
- package/build/runtime-pixelation-TZDENYAX.js.gz +0 -0
- package/build/{runtime-resize-TSDCPHB2.js → runtime-resize-M7XLJK2Z.js} +1 -1
- package/build/runtime-resize-M7XLJK2Z.js.br +0 -0
- package/build/runtime-resize-M7XLJK2Z.js.gz +0 -0
- package/build/{runtime-sceneTransition-XSH52IGF.js → runtime-sceneTransition-AU5Y32AU.js} +1 -1
- package/build/runtime-sceneTransition-AU5Y32AU.js.br +0 -0
- package/build/runtime-sceneTransition-AU5Y32AU.js.gz +0 -0
- package/build/{runtime-scroll-53LRLILO.js → runtime-scroll-GPW7QYFP.js} +1 -1
- package/build/runtime-scroll-GPW7QYFP.js.br +0 -0
- package/build/runtime-scroll-GPW7QYFP.js.gz +0 -0
- package/build/runtime-shapeBlends-PDAXXKUK.js +1 -0
- package/build/runtime-shapeBlends-PDAXXKUK.js.br +3 -0
- package/build/runtime-shapeBlends-PDAXXKUK.js.gz +0 -0
- package/build/{runtime-text-CC7PVEW4.js → runtime-text-YREQB5BX.js} +1 -1
- package/build/runtime-text-YREQB5BX.js.br +0 -0
- package/build/runtime-text-YREQB5BX.js.gz +0 -0
- package/build/{runtime-textInputs-O4IPY3CW.js → runtime-textInputs-EFSQQG2P.js} +1 -1
- package/build/{runtime-textInputs-O4IPY3CW.js.br → runtime-textInputs-EFSQQG2P.js.br} +0 -0
- package/build/runtime-textInputs-EFSQQG2P.js.gz +0 -0
- package/build/{runtime-timeline-VIZVAQRW.js → runtime-timeline-VMFKGIK3.js} +1 -1
- package/build/runtime-timeline-VMFKGIK3.js.br +0 -0
- package/build/runtime-timeline-VMFKGIK3.js.gz +0 -0
- package/build/{runtime-tracking-DAIX5CBO.js → runtime-tracking-OWGVF3I3.js} +1 -1
- package/build/runtime-tracking-OWGVF3I3.js.br +0 -0
- package/build/runtime-tracking-OWGVF3I3.js.gz +0 -0
- package/build/{runtime-transitions-B7STAPIR.js → runtime-transitions-4G2IA576.js} +1 -1
- package/build/runtime-transitions-4G2IA576.js.br +0 -0
- package/build/runtime-transitions-4G2IA576.js.gz +0 -0
- package/build/{runtime-ui2d-GRM5GCSY.js → runtime-ui2d-AEDWPLLS.js} +1 -1
- package/build/runtime-ui2d-AEDWPLLS.js.br +0 -0
- package/build/runtime-ui2d-AEDWPLLS.js.gz +0 -0
- package/build/{runtime-vectorShapes-CFS56WRE.js → runtime-vectorShapes-DUPPP7JJ.js} +1 -1
- package/build/runtime-vectorShapes-DUPPP7JJ.js.br +0 -0
- package/build/runtime-vectorShapes-DUPPP7JJ.js.gz +0 -0
- package/build/{runtime-vignette-MCOLMAOU.js → runtime-vignette-M335YXIJ.js} +1 -1
- package/build/runtime-vignette-M335YXIJ.js.br +0 -0
- package/build/runtime-vignette-M335YXIJ.js.gz +0 -0
- package/build/{runtime-webgpu-ET6ZHG3Z.js → runtime-webgpu-NLOKHPVE.js} +1 -1
- package/build/runtime-webgpu-NLOKHPVE.js.br +0 -0
- package/build/runtime-webgpu-NLOKHPVE.js.gz +0 -0
- package/build/runtime.cjs +7 -7
- 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-bloom-WOKMPZUM.js.br +0 -0
- package/build/runtime-bloom-WOKMPZUM.js.gz +0 -0
- package/build/runtime-brightnessContrast-LAZS3J44.js.br +0 -0
- package/build/runtime-brightnessContrast-LAZS3J44.js.gz +0 -0
- package/build/runtime-chromaticAberration-CJUJB3XW.js.br +0 -0
- package/build/runtime-chromaticAberration-CJUJB3XW.js.gz +0 -0
- package/build/runtime-chunk-26SNIBGW.js.br +0 -0
- package/build/runtime-chunk-26SNIBGW.js.gz +0 -0
- package/build/runtime-chunk-2BIYUOHJ.js.br +0 -0
- package/build/runtime-chunk-2BIYUOHJ.js.gz +0 -0
- package/build/runtime-chunk-3FGLYFO7.js.br +0 -0
- package/build/runtime-chunk-3FGLYFO7.js.gz +0 -0
- package/build/runtime-chunk-67G2KTJJ.js.br +0 -0
- package/build/runtime-chunk-67G2KTJJ.js.gz +0 -0
- package/build/runtime-chunk-7ECXYPPU.js.br +0 -0
- package/build/runtime-chunk-7ECXYPPU.js.gz +0 -0
- package/build/runtime-chunk-AIQFMDVO.js.br +0 -0
- package/build/runtime-chunk-AIQFMDVO.js.gz +0 -0
- package/build/runtime-chunk-CWGKGTX3.js.br +0 -0
- package/build/runtime-chunk-CWGKGTX3.js.gz +0 -0
- package/build/runtime-chunk-DULMKDNI.js.br +0 -0
- package/build/runtime-chunk-DULMKDNI.js.gz +0 -0
- package/build/runtime-chunk-EBOREXNC.js.br +0 -0
- package/build/runtime-chunk-EBOREXNC.js.gz +0 -0
- package/build/runtime-chunk-EIVMD3A7.js.br +0 -0
- package/build/runtime-chunk-EIVMD3A7.js.gz +0 -0
- package/build/runtime-chunk-F24NJYFN.js.br +0 -0
- package/build/runtime-chunk-F24NJYFN.js.gz +0 -0
- package/build/runtime-chunk-GEXOF3N3.js.br +0 -0
- package/build/runtime-chunk-GEXOF3N3.js.gz +0 -0
- package/build/runtime-chunk-H324TMOT.js.br +0 -0
- package/build/runtime-chunk-H324TMOT.js.gz +0 -0
- package/build/runtime-chunk-HOAMYWLP.js.br +0 -0
- package/build/runtime-chunk-HOAMYWLP.js.gz +0 -0
- package/build/runtime-chunk-HVKLVHUH.js.br +0 -0
- package/build/runtime-chunk-HVKLVHUH.js.gz +0 -0
- package/build/runtime-chunk-IMVM7XG3.js.br +0 -0
- package/build/runtime-chunk-IMVM7XG3.js.gz +0 -0
- package/build/runtime-chunk-JA5SKCPM.js.gz +0 -0
- package/build/runtime-chunk-JGCLZ3Q7.js.br +0 -0
- package/build/runtime-chunk-JGCLZ3Q7.js.gz +0 -0
- package/build/runtime-chunk-KL4O2RLK.js.br +0 -0
- package/build/runtime-chunk-KL4O2RLK.js.gz +0 -0
- package/build/runtime-chunk-KMB4DZ4J.js.br +0 -0
- package/build/runtime-chunk-KMB4DZ4J.js.gz +0 -0
- package/build/runtime-chunk-MJECPN22.js.br +0 -0
- package/build/runtime-chunk-MJECPN22.js.gz +0 -0
- package/build/runtime-chunk-MV7E3X22.js.br +0 -0
- package/build/runtime-chunk-MV7E3X22.js.gz +0 -0
- package/build/runtime-chunk-PLP3UUOR.js.br +0 -0
- package/build/runtime-chunk-PLP3UUOR.js.gz +0 -0
- package/build/runtime-chunk-UPR6SP3E.js.br +0 -0
- package/build/runtime-chunk-UPR6SP3E.js.gz +0 -0
- package/build/runtime-chunk-URBZFWAL.js.br +0 -2
- package/build/runtime-chunk-URBZFWAL.js.gz +0 -0
- package/build/runtime-chunk-VNBKDSM2.js.br +0 -0
- package/build/runtime-chunk-VNBKDSM2.js.gz +0 -0
- package/build/runtime-chunk-X5WK4QEQ.js.br +0 -0
- package/build/runtime-chunk-X5WK4QEQ.js.gz +0 -0
- package/build/runtime-classicRuntime-JUADSMET.js.br +0 -0
- package/build/runtime-classicRuntime-JUADSMET.js.gz +0 -0
- package/build/runtime-cloners-CFYV6RIB.js.br +0 -0
- package/build/runtime-cloners-CFYV6RIB.js.gz +0 -0
- package/build/runtime-components-73ZVG55O.js.br +0 -0
- package/build/runtime-components-73ZVG55O.js.gz +0 -0
- package/build/runtime-createDestroy-JB4TBG77.js.br +0 -0
- package/build/runtime-createDestroy-JB4TBG77.js.gz +0 -0
- package/build/runtime-depthOfField-G5EQM2NS.js.br +0 -0
- package/build/runtime-depthOfField-G5EQM2NS.js.gz +0 -0
- package/build/runtime-dragDrop-7AKEX5AU.js.br +0 -0
- package/build/runtime-dragDrop-7AKEX5AU.js.gz +0 -0
- package/build/runtime-gameControls-LE4EHTAX.js.br +0 -0
- package/build/runtime-gameControls-LE4EHTAX.js.gz +0 -0
- package/build/runtime-hair-LM7K7ULP.js.br +0 -4
- package/build/runtime-hair-LM7K7ULP.js.gz +0 -0
- package/build/runtime-hueSaturation-YLCXCGRL.js.br +0 -0
- package/build/runtime-hueSaturation-YLCXCGRL.js.gz +0 -0
- package/build/runtime-mergeStaticGeometries-INGAUYKH.js.br +0 -0
- package/build/runtime-mergeStaticGeometries-INGAUYKH.js.gz +0 -0
- package/build/runtime-miscActions-CHS3673K.js.br +0 -0
- package/build/runtime-miscActions-CHS3673K.js.gz +0 -0
- package/build/runtime-mouseHover-PUKVQX75.js.br +0 -0
- package/build/runtime-mouseHover-PUKVQX75.js.gz +0 -0
- package/build/runtime-noise-SMSEQDWF.js.br +0 -0
- package/build/runtime-noise-SMSEQDWF.js.gz +0 -0
- package/build/runtime-particles-YC55LAZE.js.br +0 -0
- package/build/runtime-particles-YC55LAZE.js.gz +0 -0
- package/build/runtime-paths-JH72VUYH.js.br +0 -0
- package/build/runtime-paths-JH72VUYH.js.gz +0 -0
- package/build/runtime-pixelation-IXZLOD7E.js.br +0 -0
- package/build/runtime-pixelation-IXZLOD7E.js.gz +0 -0
- package/build/runtime-resize-TSDCPHB2.js.br +0 -0
- package/build/runtime-resize-TSDCPHB2.js.gz +0 -0
- package/build/runtime-sceneTransition-XSH52IGF.js.br +0 -0
- package/build/runtime-sceneTransition-XSH52IGF.js.gz +0 -0
- package/build/runtime-scroll-53LRLILO.js.br +0 -0
- package/build/runtime-scroll-53LRLILO.js.gz +0 -0
- package/build/runtime-shapeBlends-7YSQLV6W.js +0 -1
- package/build/runtime-shapeBlends-7YSQLV6W.js.br +0 -0
- package/build/runtime-shapeBlends-7YSQLV6W.js.gz +0 -0
- package/build/runtime-text-CC7PVEW4.js.br +0 -0
- package/build/runtime-text-CC7PVEW4.js.gz +0 -0
- package/build/runtime-textInputs-O4IPY3CW.js.gz +0 -0
- package/build/runtime-timeline-VIZVAQRW.js.br +0 -0
- package/build/runtime-timeline-VIZVAQRW.js.gz +0 -0
- package/build/runtime-tracking-DAIX5CBO.js.br +0 -0
- package/build/runtime-tracking-DAIX5CBO.js.gz +0 -0
- package/build/runtime-transitions-B7STAPIR.js.br +0 -0
- package/build/runtime-transitions-B7STAPIR.js.gz +0 -0
- package/build/runtime-ui2d-GRM5GCSY.js.br +0 -0
- package/build/runtime-ui2d-GRM5GCSY.js.gz +0 -0
- package/build/runtime-vectorShapes-CFS56WRE.js.br +0 -0
- package/build/runtime-vectorShapes-CFS56WRE.js.gz +0 -0
- package/build/runtime-vignette-MCOLMAOU.js.br +0 -0
- package/build/runtime-vignette-MCOLMAOU.js.gz +0 -0
- package/build/runtime-webgpu-ET6ZHG3Z.js.br +0 -0
- package/build/runtime-webgpu-ET6ZHG3Z.js.gz +0 -0
package/build/runtime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,d as t,f as n,g as r}from"./runtime-chunk-QH3OZHRR.js";import{c as i,d as s,f as a}from"./runtime-chunk-X5WK4QEQ.js";import{a as o}from"./runtime-chunk-IMVM7XG3.js";import"./runtime-chunk-HD7WF3XN.js";import"./runtime-chunk-HVKLVHUH.js";import{a as l,b as c,c as h,d,e as u}from"./runtime-chunk-EBOREXNC.js";import{a as p}from"./runtime-chunk-GGSUJEGZ.js";import"./runtime-chunk-3FGLYFO7.js";import{a as m,b as f}from"./runtime-chunk-NBYTQLIB.js";import{a as v,c as y}from"./runtime-chunk-DZNU62CT.js";import"./runtime-chunk-KL4O2RLK.js";import{c as g}from"./runtime-chunk-T53JMQSH.js";import{a as b}from"./runtime-chunk-FTVQTRM7.js";import{a as w,b as E,e as _,h as j,j as P,m as M}from"./runtime-chunk-26SNIBGW.js";import"./runtime-chunk-N2ZRGNPR.js";import{a as C,d as O,e as A}from"./runtime-chunk-VAVYZ35B.js";import"./runtime-chunk-FQNSP44B.js";import{h as x}from"./runtime-chunk-JGCLZ3Q7.js";import"./runtime-chunk-HOAMYWLP.js";import{b as S,e as k,h as T}from"./runtime-chunk-CWGKGTX3.js";import"./runtime-chunk-TU4KDRKR.js";import"./runtime-chunk-67G2KTJJ.js";import{a as R}from"./runtime-chunk-AIQFMDVO.js";import"./runtime-chunk-GEXOF3N3.js";import"./runtime-chunk-UPR6SP3E.js";import"./runtime-chunk-2BIYUOHJ.js";import{I as D,M as L,O as V,P as I,W as G,b as U,f as B,i as K,k as N,ka as W,na as z,oa as H,p as F,y as $,z as q}from"./runtime-chunk-H324TMOT.js";import"./runtime-chunk-4YV3EXSU.js";import{a as Y,b as X}from"./runtime-chunk-NSD7DU3P.js";import{c as Z,d as J,f as Q,g as ee}from"./runtime-chunk-UNI3D2MC.js";import{n as te}from"./runtime-chunk-MJECPN22.js";import{a as ne,h as re}from"./runtime-chunk-RTLL6WIB.js";import{b as ie,c as se,e as ae,f as oe,h as le}from"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-MOPA2GCL.js";import{b as ce,c as he,k as de,l as ue}from"./runtime-chunk-TZCHGFVF.js";import{$ as pe,Ba as me,Da as fe,F as ve,Fa as ye,G as ge,Ga as be,H as we,Ia as Ee,T as _e,Wa as je,X as Pe,Y as Me,Z as Ce,_ as Oe,aa as Ae,ba as xe,ca as Se,ea as ke,f as Te,fa as Re,g as De,ga as Le,ha as Ve,l as Ie,o as Ge,pa as Ue,w as Be,x as Ke,y as Ne,ya as We,za as ze}from"./runtime-chunk-ADHKZQMB.js";import{a as He}from"./runtime-chunk-JA5SKCPM.js";import{Ec as Fe,Fc as $e,Gc as qe,Hc as Ye,Qc as Xe,Rc as Ze,Vc as Je,Zc as Qe,bd as et,dd as tt,fd as nt}from"./runtime-chunk-KPOUV3HD.js";import{a as rt,b as it}from"./runtime-chunk-ML3Z74BL.js";var st=rt((e,t)=>{t.exports=function(e,t){for(var n=e.split("."),r=t.split("."),i=0;i<3;i++){var s=Number(n[i]),a=Number(r[i]);if(s>a)return 1;if(a>s)return-1;if(!isNaN(s)&&isNaN(a))return 1;if(isNaN(s)&&!isNaN(a))return-1}return 0}}),at=".",ot=Symbol("target"),lt=Symbol("unsubscribe");function ct(e){return e instanceof Date||e instanceof Set||e instanceof Map||e instanceof WeakSet||e instanceof WeakMap||ArrayBuffer.isView(e)}var ht=Array.isArray;function dt(e){return"symbol"==typeof e}var ut={after:(e,t)=>ht(e)?e.slice(t.length):""===t?e:e.slice(t.length+1),concat:(e,t)=>ht(e)?(e=[...e],t&&e.push(t),e):t&&void 0!==t.toString?(""!==e&&(e+=at),dt(t)?e+t.toString():e+t):e,initial:e=>{if(ht(e))return e.slice(0,-1);if(""===e)return e;let t=e.lastIndexOf(at);return-1===t?"":e.slice(0,t)},last:e=>{if(ht(e))return e[e.length-1]||"";if(""===e)return e;let t=e.lastIndexOf(at);return-1===t?e:e.slice(t+1)},walk:(e,t)=>{if(ht(e))for(let n of e)t(n);else if(""!==e){let n=0,r=e.indexOf(at);if(-1===r)t(e);else for(;n<e.length;)-1===r&&(r=e.length),t(e.slice(n,r)),n=r+1,r=e.indexOf(at,n)}},get(e,t){return this.walk(t,t=>{e&&(e=e[t])}),e}};function pt(e,t,n){return e.isUnsubscribed||t.ignoreSymbols&&dt(n)||t.ignoreUnderscores&&"_"===n.charAt(0)||"ignoreKeys"in t&&t.ignoreKeys.includes(n)}var mt=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return void 0===this._descriptorCache&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let n=this._getProperties(e),r=n[t];return void 0===r&&(r=Reflect.getOwnPropertyDescriptor(e,t),n[t]=r),r}getProxy(e,t,n,r){if(this.isUnsubscribed)return e;let i=e[r],s=i||e;this._pathCache.set(s,t);let a=this._proxyCache.get(s);return void 0===a&&(a=void 0===i?new Proxy(e,n):e,this._proxyCache.set(s,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,ut.get(t,this.getPath(e)))}defineProperty(e,t,n){return!!Reflect.defineProperty(e,t,n)&&(this.isUnsubscribed||(this._getProperties(e)[t]=n),!0)}setProperty(e,t,n,r,i){if(!this._equals(i,n)||!(t in e)){let i=this._getOwnPropertyDescriptor(e,t);return void 0!==i&&"set"in i?Reflect.set(e,t,n,r):Reflect.set(e,t,n)}return!0}deleteProperty(e,t,n){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let r=this._getDescriptorCache().get(e);r&&(delete r[t],this._pathCache.delete(n))}return!0}return!1}isSameDescriptor(e,t,n){let r=this._getOwnPropertyDescriptor(t,n);return void 0!==e&&void 0!==r&&Object.is(e.value,r.value)&&(e.writable||!1)===(r.writable||!1)&&(e.enumerable||!1)===(r.enumerable||!1)&&(e.configurable||!1)===(r.configurable||!1)&&e.get===r.get&&e.set===r.set}isGetInvariant(e,t){let n=this._getOwnPropertyDescriptor(e,t);return void 0!==n&&!0!==n.configurable&&!0!==n.writable}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function ft(e){return"[object Object]"===toString.call(e)}function vt(){return!0}function yt(e,t){return e.length!==t.length||e.some((e,n)=>t[n]!==e)}var gt=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),bt=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),wt={push:vt,pop:vt,shift:vt,unshift:vt,copyWithin:yt,reverse:yt,sort:yt,splice:yt,flat:yt,fill:yt},Et=new Set([...gt,...bt,...Object.keys(wt)]);function _t(e,t){if(e.size!==t.size)return!0;for(let n of e)if(!t.has(n))return!0;return!1}var jt=["keys","values","entries"],Pt=new Set(["has","toString"]),Mt={add:_t,clear:_t,delete:_t,forEach:_t},Ct=new Set([...Pt,...Object.keys(Mt),...jt]);function Ot(e,t){if(e.size!==t.size)return!0;let n;for(let[r,i]of e)if(n=t.get(r),n!==i||void 0===n&&!t.has(r))return!0;return!1}var At=new Set([...Pt,"get"]),xt={set:Ot,clear:Ot,delete:Ot,forEach:Ot},St=new Set([...At,...Object.keys(xt),...jt]),kt=class{constructor(e,t,n,r){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=r,this._changes=r?[]:null,this.clone=void 0===t?e:this._shallowClone(e)}static isHandledMethod(e){return gt.has(e)}_shallowClone(e){let t=e;if(ft(e))t={...e};else if(ht(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(e=>this._shallowClone(e)));else if(e instanceof Map){t=new Map;for(let[n,r]of e.entries())t.set(n,this._shallowClone(r))}return this._clonedCache.add(t),t}preferredThisArg(e,t,n,r){return e?(ht(r)?this._onIsChanged=wt[t]:r instanceof Set?this._onIsChanged=Mt[t]:r instanceof Map&&(this._onIsChanged=xt[t]),r):n}update(e,t,n){let r=ut.after(e,this._path);if("length"!==t){let e=this.clone;ut.walk(r,t=>{e&&e[t]&&(this._clonedCache.has(e[t])||(e[t]=this._shallowClone(e[t])),e=e[t])}),this._hasOnValidate&&this._changes.push({path:r,property:t,previous:n}),e&&e[t]&&(e[t]=n)}this._isChanged=!0}undo(e){let t;for(let n=this._changes.length-1;-1!==n;n--)t=this._changes[n],ut.get(e,t.path)[t.property]=t.previous}isChanged(e){return void 0===this._onIsChanged?this._isChanged:this._onIsChanged(this.clone,e)}},Tt=class extends kt{static isHandledMethod(e){return Et.has(e)}},Rt=class extends kt{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}},Dt=class extends kt{static isHandledMethod(e){return Ct.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}},Lt=class extends kt{static isHandledMethod(e){return St.has(e)}undo(e){for(let[t,n]of this.clone.entries())e.set(t,n);for(let t of e.keys())this.clone.has(t)||e.delete(t)}},Vt=class extends kt{constructor(e,t,n,r){super(void 0,t,n,r),this._arg1=n[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}},It=class extends kt{constructor(e,t,n,r){super(void 0,t,n,r),this._weakKey=n[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}},Gt=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return ft(e)||ht(e)||ct(e)}static isHandledMethod(e,t){return ft(e)?kt.isHandledMethod(t):ht(e)?Tt.isHandledMethod(t):e instanceof Set?Dt.isHandledMethod(t):e instanceof Map?Lt.isHandledMethod(t):ct(e)}get isCloning(){return this._stack.length>0}start(e,t,n){let r=kt;ht(e)?r=Tt:e instanceof Date?r=Rt:e instanceof Set?r=Dt:e instanceof Map?r=Lt:e instanceof WeakSet?r=Vt:e instanceof WeakMap&&(r=It),this._stack.push(new r(e,t,n,this._hasOnValidate))}update(e,t,n){this._stack[this._stack.length-1].update(e,t,n)}preferredThisArg(e,t,n){let{name:r}=e,i=Gt.isHandledMethod(n,r);return this._stack[this._stack.length-1].preferredThisArg(i,r,t,n)}isChanged(e,t,n){return this._stack[this._stack.length-1].isChanged(e,t,n)}undo(e){void 0!==this._previousClone&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}},Ut={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},Bt=(e,t,n={})=>{n={...Ut,...n};let r=Symbol("ProxyTarget"),{equals:i,isShallow:s,ignoreDetached:a,details:o}=n,l=new mt(i),c="function"==typeof n.onValidate,h=new Gt(c),d=(e,t,r,i,s)=>!c||h.isCloning||!0===n.onValidate(ut.concat(l.getPath(e),t),r,i,s),u=(t,r,i,s)=>{!pt(l,n,r)&&(!a||!l.isDetached(t,e))&&p(l.getPath(t),r,i,s)},p=(e,n,r,i,s)=>{h.isCloning?h.update(e,n,i):t(ut.concat(e,n),r,i,s)},m=e=>e&&(e[r]||e),f=(t,i,o,c)=>function(e){return("object"==typeof e?null===e:"function"!=typeof e)||e instanceof RegExp}(t)||"constructor"===o||s&&!Gt.isHandledMethod(i,o)||pt(l,n,o)||l.isGetInvariant(i,o)||a&&l.isDetached(i,e)?t:(void 0===c&&(c=l.getPath(i)),l.getProxy(t,ut.concat(c,o),v,r)),v={get(e,t,n){if(dt(t)){if(t===r||t===ot)return e;if(t===lt&&!l.isUnsubscribed&&0===l.getPath(e).length)return l.unsubscribe(),e}let i=ct(e)?Reflect.get(e,t):Reflect.get(e,t,n);return f(i,e,t)},set(e,t,n,s){n=m(n);let a=e[r]||e,o=a[t];if(i(o,n)&&t in e)return!0;let c=d(e,t,n,o);return c&&l.setProperty(a,t,n,s,o)?(u(e,t,e[t],o),!0):!c},defineProperty(e,t,n){if(!l.isSameDescriptor(n,e,t)){let r=e[t];d(e,t,n.value,r)&&l.defineProperty(e,t,n,r)&&u(e,t,n.value,r)}return!0},deleteProperty(e,t){if(!Reflect.has(e,t))return!0;let n=Reflect.get(e,t),r=d(e,t,void 0,n);return r&&l.deleteProperty(e,t,n)?(u(e,t,void 0,n),!0):!r},apply(t,n,s){let a=n[r]||n;if(l.isUnsubscribed)return Reflect.apply(t,a,s);if((!1===o||!0!==o&&!o.includes(t.name))&&Gt.isHandledType(a)){let r=ut.initial(l.getPath(t)),o=Gt.isHandledMethod(a,t.name);h.start(a,r,s);let c=Reflect.apply(t,h.preferredThisArg(t,n,a),o?s.map(e=>m(e)):s),u=h.isChanged(a,i),y=h.stop();if(Gt.isHandledType(c)&&o&&(n instanceof Map&&"get"===t.name&&(r=ut.concat(r,s[0])),c=l.getProxy(c,r,v)),u){let n={name:t.name,args:s,result:c},i=h.isCloning?ut.initial(r):r,o=h.isCloning?ut.last(r):"";d(ut.get(e,i),o,a,y,n)?p(i,o,a,y,n):h.undo(a)}return(n instanceof Map||n instanceof Set)&&function(e){return"object"==typeof e&&"function"==typeof e.next}(c)?function(e,t,n,r,i){let s=e.next;if("entries"===t.name)e.next=function(){let e=s.call(this);return!1===e.done&&(e.value[0]=i(e.value[0],t,e.value[0],r),e.value[1]=i(e.value[1],t,e.value[0],r)),e};else if("values"===t.name){let a=n[ot].keys();e.next=function(){let e=s.call(this);return!1===e.done&&(e.value=i(e.value,t,a.next().value,r)),e}}else e.next=function(){let e=s.call(this);return!1===e.done&&(e.value=i(e.value,t,e.value,r)),e};return e}(c,t,n,r,f):c}return Reflect.apply(t,n,s)}},y=l.getProxy(e,n.pathAsArray?[]:"",v);return t=t.bind(y),c&&(n.onValidate=n.onValidate.bind(y)),y};Bt.target=e=>e&&e[ot]||e,Bt.unsubscribe=e=>e[lt]||e;var Kt=Bt,Nt="__splineHtmlContent",Wt=`(function () {\n\t'use strict';\n\tvar MARKER = ${JSON.stringify(Nt)};\n\tvar callSeq = 1;\n\tvar pending = {};\n\tvar listeners = {};\n\tvar acked = false;\n\tvar readyResolve;\n\tvar readyPromise = new Promise(function (resolve) { readyResolve = resolve; });\n\n\tfunction post(msg) {\n\t\tmsg[MARKER] = true;\n\t\ttry {\n\t\t\twindow.parent.postMessage(msg, '*');\n\t\t} catch (e) { /* parent gone — nothing to do */ }\n\t}\n\n\tfunction call(method, args) {\n\t\treturn new Promise(function (resolve, reject) {\n\t\t\tvar id = callSeq++;\n\t\t\tpending[id] = { resolve: resolve, reject: reject };\n\t\t\tpost({ kind: 'call', id: id, method: method, args: args });\n\t\t});\n\t}\n\n\t// ---- the public API ----------------------------------------------------\n\tvar spline = {\n\t\t/** Resolves once the editor has acknowledged the frame. */\n\t\tready: readyPromise,\n\t\tsetVariable: function (name, value) { return call('setVariable', [name, value]); },\n\t\tsetVariables: function (variables) { return call('setVariables', [variables]); },\n\t\tgetVariable: function (name) { return call('getVariable', [name]); },\n\t\tgetVariables: function () { return call('getVariables', []); },\n\t\tgetAllObjects: function () { return call('getAllObjects', []); },\n\t\tfindObjectByName: function (name) { return call('findObjectByName', [name]); },\n\t\tfindObjectById: function (id) { return call('findObjectById', [id]); },\n\t\t/** Read a mesh's live geometry ({vertexCount, triangleCount, indexed, bounds, vertices: Float32Array, indices?, normals?, uvs?}); options {space: 'local'|'world'}. Resolves undefined (with a console warning) when unreadable. */\n\t\tgetGeometry: function (nameOrId, options) { return call('getGeometry', [nameOrId, options || {}]); },\n\t\t/** Runtime-only transform/visibility update ({position,rotation,scale,visible}; rotation in degrees). */\n\t\tupdateObject: function (nameOrId, props) { return call('updateObject', [nameOrId, props]); },\n\t\t/** Runtime-only object creation ('Cube', 'Sphere', …, 'Text', 'Group', lights); resolves to the new object's snapshot. */\n\t\tcreateObject: function (type, options) {\n\t\t\t// A three.js material instance or createCustomMaterial factory can't cross\n\t\t\t// the postMessage boundary (textures/callbacks/functions fail\n\t\t\t// structured clone) — fail loud, not with a cryptic DataCloneError.\n\t\t\tif (options && options.material && (\n\t\t\t\toptions.material.isMaterial === true ||\n\t\t\t\ttypeof options.material === 'function'\n\t\t\t)) {\n\t\t\t\treturn Promise.reject(new Error(\n\t\t\t\t\t'createObject: custom three.js materials need the inline ' +\n\t\t\t\t\t'HTML-content mode (the editor Preview/Play frame and web ' +\n\t\t\t\t\t'exports); this embed runs the sandboxed mode, whose transport ' +\n\t\t\t\t\t'cannot carry them. Use a color/PBR bag or shared material ' +\n\t\t\t\t\t'name here instead.'\n\t\t\t\t));\n\t\t\t}\n\t\t\treturn call('createObject', [type, options || {}]);\n\t\t},\n\t\t/** Custom three.js/TSL materials — inline HTML-content mode only; the\n\t\t * factory function cannot cross this sandboxed transport. */\n\t\tcreateCustomMaterial: function () {\n\t\t\treturn Promise.reject(new Error(\n\t\t\t\t'createCustomMaterial: custom three.js materials need the inline ' +\n\t\t\t\t'HTML-content mode (the editor Preview/Play frame and web ' +\n\t\t\t\t'exports); this embed runs the sandboxed mode, whose transport ' +\n\t\t\t\t'cannot carry the factory function or the material it returns.'\n\t\t\t));\n\t\t},\n\t\t/** The live three texture an object samples — inline HTML-content mode\n\t\t * only; a Texture instance cannot cross this sandboxed transport. */\n\t\tgetTexture: function () {\n\t\t\treturn Promise.reject(new Error(\n\t\t\t\t'getTexture: a three.js texture instance needs the inline ' +\n\t\t\t\t'HTML-content mode (the editor Preview/Play frame and web ' +\n\t\t\t\t'exports); this embed runs the sandboxed mode, whose transport ' +\n\t\t\t\t'cannot carry it.'\n\t\t\t));\n\t\t},\n\t\t/** Replace a mesh's material with a custom three.js material — inline\n\t\t * HTML-content mode only; neither factories nor instances can cross\n\t\t * this sandboxed transport. */\n\t\tsetMaterial: function () {\n\t\t\treturn Promise.reject(new Error(\n\t\t\t\t'setMaterial: custom three.js materials need the inline ' +\n\t\t\t\t'HTML-content mode (the editor Preview/Play frame and web ' +\n\t\t\t\t'exports); this embed runs the sandboxed mode, whose transport ' +\n\t\t\t\t'cannot carry the factory function or the material it returns.'\n\t\t\t));\n\t\t},\n\t\t/** Runtime-only deep clone of an existing object; resolves to the clone's snapshot. */\n\t\tcloneObject: function (nameOrId, options) { return call('cloneObject', [nameOrId, options || {}]); },\n\t\t/** Removes an object (and its subtree); resolves to false when none matched. */\n\t\tremoveObject: function (nameOrId) { return call('removeObject', [nameOrId]); },\n\t\t/** Spawn a runtime-only copy of a template object; resolves to its snapshot ({id,...}) or undefined. */\n\t\tspawnObject: function (templateNameOrId, options) { return call('spawnObject', [templateNameOrId, options || {}]); },\n\t\t/** Remove a spawned copy by id (or assigned name). Spawned objects only. */\n\t\tdestroyObject: function (idOrName) { return call('destroyObject', [idOrName]); },\n\t\t/** Per-copy transform writes on a cloner ([{position,rotation,scale}|null, ...]; degrees); null clears all. Resolves to the copy count. */\n\t\tsetInstanceTransforms: function (nameOrId, transforms) { return call('setInstanceTransforms', [nameOrId, transforms === undefined ? null : transforms]); },\n\t\t/** An imported model's animation clips ([{id, name, duration, object: {id, name}}]) — one object's, or the whole scene's when omitted. */\n\t\tgetAnimations: function (nameOrId) { return call('getAnimations', [nameOrId]); },\n\t\t/** Play an imported clip by name or id (the object's first when omitted); options {loop: true|false|count, pingpong, fade: seconds, speed}. Resolves to the clip, or undefined. */\n\t\tplayAnimation: function (nameOrId, clip, options) { return call('playAnimation', [nameOrId, clip, options]); },\n\t\t/** Hold an object's clips (or one) where they are — every animated object when omitted; playAnimation resumes. */\n\t\tpauseAnimation: function (nameOrId, clip) { return call('pauseAnimation', [nameOrId, clip]); },\n\t\t/** Stop an object's clips (or one) on their first frame — every animated object when omitted. */\n\t\tstopAnimation: function (nameOrId, clip) { return call('stopAnimation', [nameOrId, clip]); },\n\t\t/** Trigger a Spline event on an object (requires Play mode). */\n\t\temitEvent: function (eventName, nameOrUuid) { return call('emitEvent', [eventName, nameOrUuid]); },\n\t\temitEventReverse: function (eventName, nameOrUuid) { return call('emitEventReverse', [eventName, nameOrUuid]); },\n\t\trequestRender: function () { return call('requestRender', []); },\n\t\taddEventListener: function (eventName, cb) {\n\t\t\tif (typeof cb !== 'function') return;\n\t\t\tif (!listeners[eventName]) {\n\t\t\t\tlisteners[eventName] = [];\n\t\t\t\tcall('listenEvent', [eventName]);\n\t\t\t}\n\t\t\tlisteners[eventName].push(cb);\n\t\t},\n\t\tremoveEventListener: function (eventName, cb) {\n\t\t\tvar list = listeners[eventName];\n\t\t\tif (!list) return;\n\t\t\tvar i = list.indexOf(cb);\n\t\t\tif (i !== -1) list.splice(i, 1);\n\t\t\tif (list.length === 0) {\n\t\t\t\tdelete listeners[eventName];\n\t\t\t\tcall('unlistenEvent', [eventName]);\n\t\t\t}\n\t\t},\n\t};\n\twindow.spline = spline;\n\n\t// ---- editor -> frame ---------------------------------------------------\n\twindow.addEventListener('message', function (event) {\n\t\tif (event.source !== window.parent) return;\n\t\tvar data = event.data;\n\t\tif (!data || data[MARKER] !== true) return;\n\t\tif (data.kind === 'ready-ack') {\n\t\t\tacked = true;\n\t\t\treadyResolve();\n\t\t} else if (data.kind === 'result') {\n\t\t\tvar entry = pending[data.id];\n\t\t\tif (!entry) return;\n\t\t\tdelete pending[data.id];\n\t\t\tif (data.ok) entry.resolve(data.value);\n\t\t\telse entry.reject(new Error(data.error || 'spline bridge call failed'));\n\t\t} else if (data.kind === 'event') {\n\t\t\tvar list = listeners[data.eventName];\n\t\t\tif (!list) return;\n\t\t\tfor (var i = 0; i < list.length; i++) {\n\t\t\t\ttry {\n\t\t\t\t\tlist[i](data.payload);\n\t\t\t\t} catch (e) {\n\t\t\t\t\treportError(e);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\t// ---- console + error capture --------------------------------------------\n\tfunction stringify(value, depth) {\n\t\ttry {\n\t\t\tif (typeof value === 'string') return value;\n\t\t\tif (value instanceof Error) return value.stack || String(value);\n\t\t\tif (typeof value === 'function') return '[function ' + (value.name || 'anonymous') + ']';\n\t\t\tif (value === undefined) return 'undefined';\n\t\t\tvar seen = [];\n\t\t\tvar json = JSON.stringify(value, function (k, v) {\n\t\t\t\tif (typeof v === 'object' && v !== null) {\n\t\t\t\t\tif (seen.indexOf(v) !== -1) return '[circular]';\n\t\t\t\t\tseen.push(v);\n\t\t\t\t}\n\t\t\t\tif (typeof v === 'function') return '[function]';\n\t\t\t\treturn v;\n\t\t\t});\n\t\t\treturn json === undefined ? String(value) : json;\n\t\t} catch (e) {\n\t\t\ttry { return String(value); } catch (e2) { return '[unserializable]'; }\n\t\t}\n\t}\n\n\tfunction sendConsole(level, args) {\n\t\tvar parts = [];\n\t\tfor (var i = 0; i < args.length; i++) parts.push(stringify(args[i]));\n\t\tvar text = parts.join(' ');\n\t\tif (text.length > 4000) text = text.slice(0, 4000) + '…';\n\t\tpost({ kind: 'console', level: level, text: text });\n\t}\n\n\t['log', 'info', 'warn', 'error'].forEach(function (level) {\n\t\tvar original = console[level];\n\t\tconsole[level] = function () {\n\t\t\tsendConsole(level, arguments);\n\t\t\tif (original) original.apply(console, arguments);\n\t\t};\n\t});\n\n\tfunction reportError(error) {\n\t\tsendConsole('error', [error instanceof Error ? error : String(error)]);\n\t}\n\twindow.addEventListener('error', function (event) {\n\t\tsendConsole('error', [event.message + (event.filename ? ' (' + event.filename + ':' + event.lineno + ')' : '')]);\n\t});\n\twindow.addEventListener('unhandledrejection', function (event) {\n\t\tsendConsole('error', ['Unhandled promise rejection: ' + stringify(event.reason)]);\n\t});\n\n\t// ---- input passthrough ---------------------------------------------------\n\t// A pointer that goes DOWN on the page background belongs to the 3D scene\n\t// until it is released; one that goes down on generated UI never forwards.\n\tvar forwardedPointers = {};\n\n\t// Touch: this frame covers the whole canvas, so on a phone every finger\n\t// lands in this document — where the host's \`touch-action: none\` on the\n\t// canvas can't reach. Left at the default, the browser claims the gesture\n\t// for itself: a one-finger drag scrolls the host page (and cancels the\n\t// forwarded pointer, so the orbit never starts) and a pinch zooms the\n\t// whole page instead of the camera. The scene owns gestures on the\n\t// background; a scrolling panel in the generated UI still scrolls (a\n\t// scroll container starts its own touch-action chain), and taps still\n\t// click. Not !important, so a document that wants page panning can say so.\n\tvar touchStyle = document.createElement('style');\n\ttouchStyle.textContent = 'html,body{touch-action:none}';\n\t(document.head || document.documentElement).appendChild(touchStyle);\n\t// Older iOS Safari pinch-zooms past touch-action; its gesture events are\n\t// the only way to stop that.\n\t['gesturestart', 'gesturechange'].forEach(function (type) {\n\t\tdocument.addEventListener(type, function (e) {\n\t\t\te.preventDefault();\n\t\t});\n\t});\n\n\tfunction isBackground(target) {\n\t\tif (!target || target === document || target === document.documentElement || target === document.body) {\n\t\t\treturn true;\n\t\t}\n\t\tif (target.closest && target.closest('[data-spline-passthrough]')) return true;\n\t\treturn false;\n\t}\n\n\tfunction baseInput(e, type) {\n\t\treturn {\n\t\t\ttype: type,\n\t\t\tx: e.clientX,\n\t\t\ty: e.clientY,\n\t\t\tbutton: e.button,\n\t\t\tbuttons: e.buttons,\n\t\t\tpointerId: e.pointerId,\n\t\t\tpointerType: e.pointerType,\n\t\t\tisPrimary: e.isPrimary,\n\t\t\tmovementX: e.movementX,\n\t\t\tmovementY: e.movementY,\n\t\t\tshiftKey: e.shiftKey,\n\t\t\tctrlKey: e.ctrlKey,\n\t\t\taltKey: e.altKey,\n\t\t\tmetaKey: e.metaKey,\n\t\t};\n\t}\n\n\tdocument.addEventListener('pointerdown', function (e) {\n\t\tif (!isBackground(e.target)) return;\n\t\tforwardedPointers[e.pointerId] = true;\n\t\tpost({ kind: 'input', event: baseInput(e, 'pointerdown') });\n\t}, true);\n\n\tdocument.addEventListener('pointermove', function (e) {\n\t\tif (!forwardedPointers[e.pointerId] && !isBackground(e.target)) return;\n\t\tpost({ kind: 'input', event: baseInput(e, 'pointermove') });\n\t}, true);\n\n\t['pointerup', 'pointercancel'].forEach(function (type) {\n\t\tdocument.addEventListener(type, function (e) {\n\t\t\tvar wasForwarded = forwardedPointers[e.pointerId];\n\t\t\tdelete forwardedPointers[e.pointerId];\n\t\t\tif (!wasForwarded && !isBackground(e.target)) return;\n\t\t\tpost({ kind: 'input', event: baseInput(e, type) });\n\t\t}, true);\n\t});\n\n\t['click', 'dblclick'].forEach(function (type) {\n\t\tdocument.addEventListener(type, function (e) {\n\t\t\tif (!isBackground(e.target)) return;\n\t\t\tpost({ kind: 'input', event: baseInput(e, type) });\n\t\t}, true);\n\t});\n\n\t// A right-drag on the background pans the scene; without this the browser\n\t// also opens its context menu, which the canvas's own controls suppress.\n\tdocument.addEventListener('contextmenu', function (e) {\n\t\tif (isBackground(e.target)) e.preventDefault();\n\t}, true);\n\n\tdocument.addEventListener('wheel', function (e) {\n\t\tif (!isBackground(e.target)) return;\n\t\te.preventDefault();\n\t\tvar msg = baseInput(e, 'wheel');\n\t\tmsg.deltaX = e.deltaX;\n\t\tmsg.deltaY = e.deltaY;\n\t\tmsg.deltaMode = e.deltaMode;\n\t\t// The legacy wheelDelta fields carry the trackpad-vs-mouse signature\n\t\t// the editor's pan/zoom discrimination reads (wheelDeltaY === -3*dY\n\t\t// on trackpads) — a reconstructed WheelEvent loses them, turning\n\t\t// two-finger pans into zooms. Forward them verbatim.\n\t\tif (typeof e.wheelDeltaX === 'number') msg.wheelDeltaX = e.wheelDeltaX;\n\t\tif (typeof e.wheelDeltaY === 'number') msg.wheelDeltaY = e.wheelDeltaY;\n\t\tpost({ kind: 'input', event: msg });\n\t}, { capture: true, passive: false });\n\n\t['keydown', 'keyup'].forEach(function (type) {\n\t\tdocument.addEventListener(type, function (e) {\n\t\t\t// Never steal keys from the page's own form fields.\n\t\t\tvar t = e.target;\n\t\t\tif (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;\n\t\t\tpost({ kind: 'input', event: {\n\t\t\t\ttype: type,\n\t\t\t\tkey: e.key,\n\t\t\t\tcode: e.code,\n\t\t\t\trepeat: e.repeat,\n\t\t\t\tshiftKey: e.shiftKey,\n\t\t\t\tctrlKey: e.ctrlKey,\n\t\t\t\taltKey: e.altKey,\n\t\t\t\tmetaKey: e.metaKey,\n\t\t\t} });\n\t\t}, true);\n\t});\n\n\t// ---- handshake -----------------------------------------------------------\n\t// Announce readiness and KEEP announcing until the editor acks. A single\n\t// 'ready' can race the editor attaching its listener (or land while the\n\t// editor is busy); code that awaits spline.ready would then hang forever.\n\t// The editor acks every 'ready' (and posts a proactive ack on attach), so\n\t// this settles within one round-trip in the normal case.\n\tpost({ kind: 'ready' });\n\tvar readyRetry = setInterval(function () {\n\t\tif (acked) {\n\t\t\tclearInterval(readyRetry);\n\t\t\treturn;\n\t\t}\n\t\tpost({ kind: 'ready' });\n\t}, 250);\n})();`;function zt(e){return null==e||""===e?void 0:String(e)}var Ht=class{constructor(e,t,n){this.deps=e,this.onConsole=t,this.onEvent=n,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let e of this.eventUnsubs.values())e();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(e,t){let n=this.deps;switch(e){case"setVariable":{let e=n.setVariable(String(t[0]),t[1]);return e.warning&&this.onConsole("warn",e.warning),e.ok}case"setVariables":{let e=t[0]??{},r=!0;for(let[t,i]of Object.entries(e)){let e=n.setVariable(t,i);e.warning&&this.onConsole("warn",e.warning),r=r&&e.ok}return r}case"getVariable":return n.getVariable(String(t[0]));case"getVariables":return n.getVariables();case"getAllObjects":return n.getAllObjects();case"findObjectByName":case"findObjectById":return n.findObject(String(t[0]));case"getGeometry":{let e=n.getGeometry(String(t[0]),t[1]??{});return e.warning&&this.onConsole("warn",e.warning),e.data}case"updateObject":return n.updateObject(String(t[0]),t[1]??{});case"createObject":return n.createObject(String(t[0]),t[1]??{});case"createCustomMaterial":if(void 0===n.createCustomMaterial)throw new Error("createCustomMaterial: not available on this surface — custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.createCustomMaterial(t[0]);case"getTexture":if(void 0===n.getTexture)throw new Error("getTexture: not available on this surface — a three.js texture instance needs the inline HTML-content mode (editor Preview/Play and web exports).");return n.getTexture(String(t[0]),t[1]??{});case"setMaterial":if(void 0===n.setMaterial)throw new Error("setMaterial: not available on this surface — custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.setMaterial(String(t[0]),t[1]);case"cloneObject":return n.cloneObject(String(t[0]),t[1]??{});case"removeObject":return n.removeObject(String(t[0]));case"spawnObject":{let e=n.spawnObject(String(t[0]),t[1]??{});return e.warning&&this.onConsole("warn",e.warning),e.object}case"destroyObject":return n.destroyObject(String(t[0]));case"setInstanceTransforms":{let e=null===t[1]||void 0===t[1]?null:t[1],r=n.setInstanceTransforms(String(t[0]),e);return r<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(t[0])}" has no cloner — make the object a cloner first (its copies are what this drives).`),r}case"getAnimations":{let r=n.getAnimations(zt(t[0]));return r.warning&&this.onConsole("warn",`spline.${e}: ${r.warning}`),r.clips}case"playAnimation":{let r="object"==typeof t[1]&&null!==t[1],i=n.playAnimation(String(t[0]),r?void 0:zt(t[1]),(r?t[1]:t[2])??{});return i.warning&&this.onConsole("warn",`spline.${e}: ${i.warning}`),i.clip}case"pauseAnimation":case"stopAnimation":{let r=zt(t[0]),i=zt(t[1]),s="pauseAnimation"===e?n.pauseAnimation(r,i):n.stopAnimation(r,i);return s.warning&&this.onConsole("warn",`spline.${e}: ${s.warning}`),s.ok}case"emitEvent":case"emitEventReverse":{let r=n.emitEvent(String(t[0]),String(t[1]),"emitEventReverse"===e);return r.warning&&this.onConsole("warn",r.warning),r.ok}case"requestRender":return n.requestRender(),!0;case"listenEvent":{let e=String(t[0]);return"variableChange"===e?this.startVariablePolling():this.eventUnsubs.has(e)||this.eventUnsubs.set(e,n.addSplineEventListener(e,t=>{this.onEvent(e,t)})),!0}case"unlistenEvent":{let e=String(t[0]);return"variableChange"===e?this.stopVariablePolling():(this.eventUnsubs.get(e)?.(),this.eventUnsubs.delete(e)),!0}default:throw new Error(`Unknown spline bridge method: ${e}`)}}startVariablePolling(){null===this.variablePollHandle&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let e=this.deps.getVariables(),t=function(e,t){let n=[];for(let r of Object.keys(t))e[r]!==t[r]&&n.push({name:r,value:t[r]});return n}(this.lastVariables??{},e);this.lastVariables=e;for(let e of t)this.onEvent("variableChange",e)},100))}stopVariablePolling(){null!==this.variablePollHandle&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}};function Ft(e,t,n,r){return[e[0]*t+e[4]*n+e[8]*r+e[12],e[1]*t+e[5]*n+e[9]*r+e[13],e[2]*t+e[6]*n+e[10]*r+e[14]]}var $t=class{constructor(e,t,n){this.iframe=e,this.deps=t,this.onConsole=n,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=e=>{if(this.disposed||e.source!==this.iframe.contentWindow)return;let t=e.data;var n;"object"!=typeof(n=t)||null===n||!0!==n[Nt]||"string"!=typeof n.kind||this.handleMessage(t)},this.host=new Ht(t,n,(e,t)=>{this.sendEvent(e,t)})}attach(){window.addEventListener("message",this.onMessage),this.send({[Nt]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) — if the page looks frozen, check for errors in its code.")},6e3)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),null!==this.handshakeTimer&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(e){switch(e.kind){case"ready":this.handshakeSeen=!0,this.send({[Nt]:!0,kind:"ready-ack"});break;case"console":this.onConsole(e.level,e.text);break;case"call":{let t;try{t=Promise.resolve(this.host.execute(e.method,e.args))}catch(e){t=Promise.reject(e)}t.then(t=>{this.send({[Nt]:!0,kind:"result",id:e.id,ok:!0,value:t,error:void 0})},t=>{let n=t instanceof Error?t.message:String(t);this.send({[Nt]:!0,kind:"result",id:e.id,ok:!1,value:void 0,error:n}),this.onConsole("error",n)});break}case"input":this.dispatchInput(e.event)}}send(e){this.iframe.contentWindow?.postMessage(e,"*")}sendEvent(e,t){this.send({[Nt]:!0,kind:"event",eventName:e,payload:t})}dispatchInput(e){let t=this.deps.getCanvas();if(!t)return;let n=this.iframe.getBoundingClientRect(),r={bubbles:!0,cancelable:!0,view:window,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey};switch(e.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":t.dispatchEvent(new PointerEvent(e.type,{...r,clientX:(e.x??0)+n.left,clientY:(e.y??0)+n.top,button:e.button,buttons:e.buttons,pointerId:e.pointerId,pointerType:e.pointerType,isPrimary:e.isPrimary,movementX:e.movementX,movementY:e.movementY}));break;case"click":case"dblclick":t.dispatchEvent(new MouseEvent(e.type,{...r,clientX:(e.x??0)+n.left,clientY:(e.y??0)+n.top,button:e.button,buttons:e.buttons}));break;case"wheel":{let i=new WheelEvent("wheel",{...r,clientX:(e.x??0)+n.left,clientY:(e.y??0)+n.top,deltaX:e.deltaX,deltaY:e.deltaY,deltaMode:e.deltaMode});"number"==typeof e.wheelDeltaX&&Object.defineProperty(i,"wheelDeltaX",{value:e.wheelDeltaX}),"number"==typeof e.wheelDeltaY&&Object.defineProperty(i,"wheelDeltaY",{value:e.wheelDeltaY}),t.dispatchEvent(i);break}case"keydown":case"keyup":t.dispatchEvent(new KeyboardEvent(e.type,{...r,key:e.key,code:e.code,repeat:e.repeat}))}}};function qt(e){let t=e.points.length/7,n=new Te;for(let r=0;r<t;r++){let t=7*r,i=e.points[t+0],s=e.points[t+1],a=e.points[t+2],o=e.points[t+3],l=e.points[t+4],c=e.points[t+5],h=e.points[t+6];n.push({fi:r,id:Fe.generateUUID(),data:{roundness:h,position:[i,s],areControlsDirectionsMirrored:!0,controlPrevious:{position:[a,o]},controlNext:{position:[l,c]}}})}return{points:n,isClosed:e.isClosed,roundness:e.roundness,shapeHoles:e.shapeHoles?.map(e=>qt(e))??[]}}function Yt(e){let{userData:t,uuid:n,...r}=e;if(void 0===t||"NonParametricGeometry"===t.type)return function(e){let t,{userData:n,data:r}=e,i=r?.groups,s=r?.attributes??{},a=r?.morphAttributes??{},o=r?.interleavedBuffers,l=r?.arrayBuffers,c=r?.index;void 0!==s.position&&Array.isArray(s.position.array)&&(t=function(e){let t=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,a=-1/0;for(let o=0;o<e.length;o+=3){let l=e[o],c=e[o+1],h=e[o+2];t=Math.min(t,l),n=Math.min(n,c),r=Math.min(r,h),i=Math.max(i,l),s=Math.max(s,c),a=Math.max(a,h)}return{width:i-t,height:s-n,depth:a-r}}(s.position.array));let h={...void 0===n?{}:n.parameters,data:{attributes:s,morphAttributes:a,interleavedBuffers:o,arrayBuffers:l},...void 0===t?{}:t,type:"NonParametricGeometry"};return void 0!==c&&Object.assign(h.data,{index:c}),void 0!==i&&Object.assign(h.data,{groups:i.map(e=>({...e,materialIndex:e.materialIndex??0}))}),h}(e);if("SubdivGeometry"===t.type){let e="SubdivGeometry",n=r.data?.attributes;if(void 0===n?.positionWASM){let e=new nt;if(void 0===n?.position||void 0===n?.faceMap)return null;let t=n.position.array,i=n.faceMap.array,s=r.data.index.array;e.setAttribute("position",new tt(t,3)),e.setIndex(new et(s,1));let a=U(e),o=[],l=new Array(i[i.length-1]+1).fill(3),c=a.getIndex().array;for(let e=0,t=i.length;e<t;)i[e]===i[e+1]?(l[i[e]]++,o.push(...new Set(c.slice(3*e,3*e+6))),e+=2):(o.push(...c.slice(3*e,3*e+3)),e++);n.indexWASM={array:o},n.positionWASM=a.attributes.position,n.verticesPerFaceWASM={array:l}}if(void 0===n?.positionWASM||0===n?.positionWASM.length||void 0===n?.indexWASM||0===n?.indexWASM.length||void 0===n?.verticesPerFaceWASM||0===n?.verticesPerFaceWASM.length)return null;let i={type:e,...Jt(n.positionWASM.array)};i.subdivisions=t.parameters.subdivisions;for(let e in n)"positionWASM"===e?i[e]=new Float32Array(n[e].array):"indexWASM"===e?i[e]=new Int32Array(n[e].array):"verticesPerFaceWASM"===e&&(i[e]=new Int8Array(n[e].array));return i.scaleBaked=[1,1,1],i}let i=t.type,s=t.parameters;return"VectorGeometry"===i?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:qt(t.shape),type:i}):"LatheGeometry"===i?{...t.parameters,type:i,points:(t?.parameters.points??[]).map(e=>[e.x,e.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:i})}new Xe,new qe,new Ze,new Ye,new Ye;var Xt=new Qe,Zt=new Ye;function Jt(e){return Xt.setFromArray(e),Xt.getSize(Zt),{width:Zt.x,height:Zt.y,depth:Zt.z}}var Qt=class{constructor(e,t,n,r,i,s){if(this.id=e,this.data=t,this.object=n,this.entered=!1,("KeyDown"===t.type||"KeyUp"===t.type||"KeyPress"===t.type)&&!t.key)throw new Error("Missing property");this.actions=Q(t,t.actions,r,i,s,n)}disconnect(){ee(this.actions)}dispatchHeld(e){this.actions.Create.forEach(t=>{e&&t.dispatchThrottled.cancel(),t.dispatchThrottled()})}dispatch(e=!1){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),"MousePress"===this.data.type||"KeyPress"===this.data.type?this.entered||(this.entered=!0,this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStart())):(this.actions.Transition.some(e=>e.playing&&"Toggle"!==e.data.runMode)||this.actions.Transition.forEach(e=>e.play()),this.actions.SwitchCamera.some(e=>e.playing&&"Toggle"!==e.data.runMode)||this.actions.SwitchCamera.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.Animation.forEach(e=>{"runMode"in e.data&&"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&"Toggle"===e.data.runMode?e.toggle():e.play()})),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),!1===e&&this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}dispatchRelease(){this.entered&&(this.entered=!1,this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Particles.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStop()))}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent())),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}},en=class extends v{constructor(e,t,n){super(e),this.eventManager=t,this.useForRaycastProperty=n,this.objectsPerTypes={MouseDown:[],MouseUp:[],MousePress:[],KeyDown:[],KeyUp:[],KeyPress:[]},this.canvasMouseEvents=[],this.eventsPerObjects={MouseDown:{},MouseUp:{},MousePress:{},KeyDown:{},KeyUp:{},KeyPress:{}},this.heldKeys={},this.heldKeysPress={},this._prevObjects=[],this.sceneInterects=null,this.onCanvasRaycast=e=>{if(!0===this.useForRaycastProperty&&null===this.sceneInterects){this.eventContext.updateRaycaster(e);let{raycaster:t,page:n}=this.eventContext,r=l(t,n,[],!0);this.sceneInterects=r,r.length&&(this.eventContext.sharedAssets.raycastProperty={x:r[0].point.x,y:r[0].point.y,z:r[0].point.z,objX:r[0].object.matrixWorld.elements[12],objY:r[0].object.matrixWorld.elements[13],objZ:r[0].object.matrixWorld.elements[14]})}},this.onCanvasMouseDown=e=>{(e.target===this.eventContext.domElement||"SPLINE-VIEWER"===e.target.tagName)&&this.canvasMouseEvents.forEach(t=>{("MouseDown"===t.data.type||"MousePress"===t.data.type)&&(this.onCanvasRaycast(e),t.dispatch())})},this.onCanvasMouseUp=e=>{(e.target===this.eventContext.domElement||"SPLINE-VIEWER"===e.target.tagName)&&this.canvasMouseEvents.forEach(t=>{"MouseUp"===t.data.type?(this.onCanvasRaycast(e),t.dispatch()):"MousePress"===t.data.type&&t.dispatchRelease()})},this.onMouseDown=e=>{C.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseEvent("MouseDown"))},this.onMouseUp=e=>{C.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseEvent("MouseUp"))},this.onMousePressDown=e=>{C.length>1||(this.eventContext.updateRaycaster(e),this.handleMousePressEvent())},this.onMousePressRelease=e=>{C.length>1||(this.eventContext.updateRaycaster(e),this.handleMousePressEvent(!0))},this.onKeyDown=e=>{this.heldKeys[e.key]||(this.handleKeyEvent(e,"KeyDown"),this.handleKeyEventHeld(e,"KeyDown",!0)),this.heldKeys[e.key]=!0},this.onKeyUp=e=>{this.handleKeyEvent(e,"KeyUp"),this.handleKeyEventHeld(e,"KeyUp",!0)},this.onKeyPressDown=e=>{this.heldKeysPress[e.key]?this.handleKeyEventHeld(e,"KeyPress"):(this.handleKeyEvent(e,"KeyPress"),this.handleKeyEventHeld(e,"KeyPress",!0)),this.heldKeysPress[e.key]=!0},this.onKeyPressUp=e=>{this.handleKeyEvent(e,"KeyPress",!0)},this.releaseHeldKey=e=>{delete this.heldKeys[e.key]},this.releaseHeldKeyPress=e=>{delete this.heldKeysPress[e.key]},this._onUserEvent=({eventName:e,target:t,reverse:n})=>{if(!e||!t)return;let r=m(e);r&&("MouseDown"===r||"MouseUp"===r||"MousePress"===r?(t.dispatchEvent({type:"beginEvent",eventName:r}),this.eventsPerObjects[r]?.[t.uuid]?.forEach(e=>{e.dispatchUserEvent(n)}),this.canvasMouseEvents.forEach(e=>{e.dispatchUserEvent(n)})):("KeyDown"===r||"KeyUp"===r||"KeyPress"===r)&&(t.dispatchEvent({type:"beginEvent",eventName:r}),this.eventsPerObjects[r]?.[t.uuid]?.forEach(e=>{e.dispatchUserEvent()})))}}connect(){let{page:e,sharedAssets:t,domElement:n}=this.eventContext,r=(n,r)=>{if(!n.data?.events.length)return;let i=["MouseDown","MouseUp","MousePress","KeyDown","KeyUp","KeyPress"];for(let s of i){let i=this.eventsPerObjects[s];if(n.data.events.filter(({data:e})=>e.type===s&&!0!==e.disabled).forEach(({id:r,data:s})=>{try{let a=new Qt(r,s,n,e,t,this.eventManager);a.actions.Video.length&&(this.hasVideoAction=!0),"MouseDown"!==s.type&&"MouseUp"!==s.type&&"MousePress"!==s.type||"Canvas"!==s.mode&&"Window"!==s.mode?(i[n.uuid]?i[n.uuid].some(e=>e.id===a.id)||i[n.uuid].push(a):i[n.uuid]=[a],se(n)&&n.traverseChildren(e=>{if(!e.visible)return!0;e instanceof H&&"shapeBlendNode"in e.data.geometry&&2!==e.data.geometry.shapeBlendNode?.operation&&(i[e.uuid]?i[e.uuid].push(a):i[e.uuid]=[a])})):this.canvasMouseEvents.push(a)}catch(e){}}),i[n.uuid]?.length&&(this.objectsPerTypes[s].push(!ae(n)||"MouseDown"!==s&&"MouseUp"!==s&&"MousePress"!==s?n:r),se(n))){let e=this.objectsPerTypes[s];n.traverseChildren(t=>{if(!t.visible)return!0;t instanceof H&&-1===e.indexOf(t)&&e.push(t)})}}};e.traverseEntity(e=>{(oe(e)||e instanceof x)&&e.frame?.traverse(t=>{r(t,e)}),r(e)}),this.heldKeys={},this.heldKeysPress={},this.domEventsNeeded.clear(),n.addEventListener("pointerdown",this.onCanvasMouseDown),n.addEventListener("pointerup",this.onCanvasMouseUp),(this.objectsPerTypes.MouseDown?.length||this.useForRaycastProperty)&&(this.domEventsNeeded.add("pointerdown"),n.addEventListener("pointerdown",this.onMouseDown)),this.objectsPerTypes.MouseUp?.length&&(this.domEventsNeeded.add("pointerup"),n.addEventListener("pointerup",this.onMouseUp)),this.objectsPerTypes.MousePress?.length&&(this.domEventsNeeded.add("pointerdown"),n.addEventListener("pointerdown",this.onMousePressDown),this.domEventsNeeded.add("pointerup"),n.addEventListener("pointerup",this.onMousePressRelease)),this.objectsPerTypes.KeyDown?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.releaseHeldKey)),this.objectsPerTypes.KeyUp?.length&&(this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyUp)),this.objectsPerTypes.KeyPress?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyPressDown),document.addEventListener("keyup",this.releaseHeldKeyPress),this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyPressUp)),Object.entries(this.objectsPerTypes).forEach(([e,t])=>{t.forEach(e=>{e.addEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(e=>{e.object.addEventListener("userEvent",this._onUserEvent)})}disconnect(){let{domElement:e}=this.eventContext;this.domEventsNeeded.clear(),this.heldKeys={},this.heldKeysPress={},e.removeEventListener("pointerdown",this.onCanvasMouseDown),e.removeEventListener("pointerup",this.onCanvasMouseUp),e.removeEventListener("pointerdown",this.onMouseDown),e.removeEventListener("pointerdown",this.onMousePressDown),e.removeEventListener("pointerup",this.onMouseUp),e.removeEventListener("pointerup",this.onMousePressRelease),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp),document.removeEventListener("keydown",this.onKeyPressDown),document.removeEventListener("keyup",this.onKeyPressUp),document.removeEventListener("keyup",this.releaseHeldKey),Object.values(this.eventsPerObjects).forEach(e=>{Object.values(e).forEach(e=>{e.forEach(e=>{e.disconnect()})})}),this.canvasMouseEvents.forEach(e=>{e.disconnect()}),Object.entries(this.objectsPerTypes).forEach(([e,t])=>{t.forEach(e=>{e.removeEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(e=>{e.object.removeEventListener("userEvent",this._onUserEvent)})}handleMouseEvent(e){let{stopRaycast:t,raycaster:n,page:r,pointerScreen:i}=this.eventContext,s=this.objectsPerTypes[e],a=s.filter(e=>!ae(e));if((s.length||this.useForRaycastProperty)&&(!r.uiCanvas||!h(r,[i.x,i.y],Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}))){if(t||this.useForRaycastProperty){let i;if(null===this.sceneInterects?i=l(n,r,a,this.useForRaycastProperty):(i=this.sceneInterects,this.sceneInterects=null),this.useForRaycastProperty&&i.length&&(this.eventContext.sharedAssets.raycastProperty={x:i[0].point.x,y:i[0].point.y,z:i[0].point.z,objX:i[0].object.matrixWorld.elements[12],objY:i[0].object.matrixWorld.elements[13],objZ:i[0].object.matrixWorld.elements[14]}),t){let t=[i[0]?.uv?.x??0,i[0]?.uv?.y??0];c(i).forEach(n=>{oe(n)&&h(n,t,Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}),this.eventsPerObjects[e][n.uuid]&&this.handleObjectMouseEventDispatch(n,e)})}}t||a.forEach(t=>{let r=d(n,t);r&&(this.handleObjectMouseEventDispatch(t,e),oe(t)&&h(t,[r?.uv?.x??0,r?.uv?.y??0],Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}))})}}handleMousePressEvent(e=!1){let t="MousePress",n=this.objectsPerTypes[t],r=n.filter(e=>!ae(e)),i=[];if(n.length){if(!e){let{stopRaycast:e,raycaster:n,page:s,pointerScreen:a}=this.eventContext,o=!1;if(s.uiCanvas&&(o=h(s,[a.x,a.y],Object.keys(this.eventsPerObjects[t]),e=>{i.push(e)})),e&&!o){let e=l(n,s,r);i=c(e),e.forEach(e=>{oe(e.object)&&h(e.object,[e?.uv?.x??0,e?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),e=>{i.push(e)})})}else r.forEach(e=>{let r=d(n,e);r&&(i.push(e),oe(e)&&h(e,[r?.uv?.x??0,r?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),e=>{i.push(e)}))})}this._prevObjects.length&&this._prevObjects.forEach(e=>{i.includes(e)||this.handleObjectMouseEventDispatchRelease(e,t)}),i.length&&i.forEach(e=>{this.handleObjectMouseEventDispatch(e,t)}),this._prevObjects=i}}handleObjectMouseEventDispatch(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(e=>{e.dispatch()})}handleObjectMouseEventDispatchRelease(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(e=>{e.dispatchRelease()})}handleKeyEvent(e,t,n=!1){this.objectsPerTypes[t].forEach(r=>{let i=this.eventsPerObjects[t][r.uuid];i.some(({data:t})=>"key"in t&&t.key===e.key)&&r.dispatchEvent({type:"beginEvent",eventName:t}),i.forEach(t=>{"key"in t.data&&t.data.key===e.key&&(n?t.dispatchRelease():t.dispatch(!0))})})}handleKeyEventHeld(e,t,n=!1){this.objectsPerTypes[t].forEach(r=>{this.eventsPerObjects[t][r.uuid].forEach(t=>{"key"in t.data&&t.data.key===e.key&&t.dispatchHeld(n)})})}},tn=e=>!0===e?.isPlayAudioAction,nn=e=>!0===e?.isPauseAudioAction,rn=e=>!0===e?.isPlayVideoAction,sn=e=>!0===e?.isPauseVideoAction,an=class{constructor(e,t,n,r,i,s){this.id=e,this.data=t,this.object=n,this.actions=Q(t,t.actions,r,i,s,n)}disconnect(){ee(this.actions)}dispatch(){this.actions.Transition.forEach(e=>{e.play()}),this.actions.Animation.forEach(e=>{e.play()}),this.actions.TimelineAnimation.forEach(e=>{e.play()}),this.actions.SwitchCamera.forEach(e=>{e.play()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()),this.actions.Create.forEach(e=>{e.dispatchFromStart()}),this.actions.Destroy.forEach(e=>{e.dispatchFromStart()})}dispatchAfter(e){this.actions.Audio.forEach(t=>{(t.interaction.data.triggerAfter??"any")===e&&(tn(t.interaction)?t.interaction.audioPlayer?.play():nn(t.interaction)&&t.interaction.dispatch())}),this.actions.Video.forEach(t=>{let n=t.interaction.data.triggerAfter??"autoplay";n===e&&(rn(t.interaction)?t.interaction.play("autoplay"===n):sn(t.interaction)&&t.interaction.dispatch())}),this.actions.Particles.forEach(t=>{(t.data.triggerAfter??"any")===e&&t.dispatchBasic()})}async seekVideos(e){let t=[];this.actions.Video.forEach(n=>{"autoplay"===(n.interaction.data.triggerAfter??"autoplay")&&rn(n.interaction)&&t.push(n.interaction.seek(e))}),await Promise.all(t)}pauseVideos(){this.actions.Video.forEach(e=>{rn(e.interaction)&&e.interaction.pause()})}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent())),this.actions.SceneTransition.forEach(e=>e.dispatch()),this.actions.Reset.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{tn(e.interaction)?e.interaction.audioPlayer?.play():nn(e.interaction)&&e.interaction.dispatch()}),this.actions.Video.forEach(e=>{rn(e.interaction)?e.interaction.play():sn(e.interaction)&&e.interaction.dispatch()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()})}},on=class extends v{constructor(e,t){super(e),this.eventManager=t,this.eventsPerObject=new Map,this.eventsAfterPerObject=new Map,this.onMouseDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("mouseDown")})})},this.onKeyDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("keyDown")})})},this.onAny=()=>{let{domElement:e,isExport:t}=this.eventContext,n=t?document:e;n.removeEventListener("pointerdown",this.onAny),n.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("any")})})},this.onSceneTransitionAudioVideoPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.actions.Audio.forEach(e=>{tn(e.interaction)&&e.interaction.audioPlayer?.play()}),e.actions.Video.forEach(e=>{let t=e.interaction.data.triggerAfter??"autoplay";rn(e.interaction)&&e.interaction.play("autoplay"===t)}),e.actions.Particles.forEach(e=>{e.dispatchBasic()})})})},this.onPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("autoplay")})})},this.seekVideos=async e=>{let t=[];[...this.eventsAfterPerObject.entries()].forEach(([n,r])=>{!n.data.visible||r.forEach(n=>{t.push(n.seekVideos(e))})}),await Promise.all(t)},this.pauseVideos=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{t.forEach(e=>{e.pauseVideos()})})},this.onUserEvent=({eventName:e,target:t,reverse:n})=>{if(!e||!t)return;let r=m(e);r&&"Start"===r&&(ae(t)||t.dispatchEvent({type:"beginEvent",eventName:"Start"}),this.eventsPerObject.get(t)?.forEach(e=>{e.dispatchUserEvent(n)}),this.eventsAfterPerObject.get(t)?.forEach(e=>{e.dispatchUserEvent(n)}))}}connect(){let{sharedAssets:e,page:t}=this.eventContext,n=n=>{if(n.data?.events.length)for(let{id:r,data:i}of n.data.events){if(i.disabled||"Start"!==i.type)continue;let s=new an(r,i,n,t,e,this.eventManager);(s.actions.Transition.length||s.actions.TimelineAnimation.length||s.actions.Animation.length||s.actions.SwitchCamera.length||s.actions.Create.length||s.actions.Destroy.length||s.actions.SceneTransition.length||s.actions.Reset.length||s.actions.SetVariable.length||s.actions.DynamicVariablePlay.length||s.actions.ClearLocalStorage.length||s.actions.UserAPI.length)&&(this.eventsPerObject.has(n)?this.eventsPerObject.get(n)?.push(s):this.eventsPerObject.set(n,[s])),s.actions.Audio.length&&(this.eventsAfterPerObject.has(n)?this.eventsAfterPerObject.get(n)?.push(s):this.eventsAfterPerObject.set(n,[s])),s.actions.Video.length&&(this.hasVideoAction=!0,this.eventsAfterPerObject.has(n)?this.eventsAfterPerObject.get(n)?.push(s):this.eventsAfterPerObject.set(n,[s])),s.actions.Particles.length&&(this.eventsAfterPerObject.has(n)?this.eventsAfterPerObject.get(n)?.push(s):this.eventsAfterPerObject.set(n,[s]))}};if(t.traverseEntity(e=>{(oe(e)||e instanceof x)&&e.frame?.traverse(e=>{n(e)}),n(e)}),[...this.eventsAfterPerObject.values()].some(e=>e.length)){if(0===this.eventManager.activateCount){let{domElement:e,isExport:t}=this.eventContext,n=t?document:e;n.addEventListener("pointerdown",this.onMouseDown,{once:!0}),n.addEventListener("mousedown",this.onMouseDown,{once:!0}),document.addEventListener("keydown",this.onKeyDown,{once:!0}),n.addEventListener("pointerdown",this.onAny),n.addEventListener("mousedown",this.onAny),document.addEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.addEventListener("userEvent",this.onUserEvent)})}else this.onSceneTransitionAudioVideoPlay();this.onPlay()}[...this.eventsPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>e.dispatch()),e.addEventListener("userEvent",this.onUserEvent)})}disconnect(){if([...this.eventsAfterPerObject.values()].some(e=>e.length)){let{domElement:e,isExport:t}=this.eventContext,n=t?document:e;n.removeEventListener("pointerdown",this.onMouseDown),n.removeEventListener("mousedown",this.onMouseDown),document.removeEventListener("keydown",this.onKeyDown),n.removeEventListener("pointerdown",this.onAny),n.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.removeEventListener("userEvent",this.onUserEvent),t.forEach(e=>e.disconnect())})}[...this.eventsPerObject.entries()].forEach(([e,t])=>{e.removeEventListener("userEvent",this.onUserEvent),t.forEach(e=>e.disconnect())}),this.eventsPerObject.clear(),this.eventsAfterPerObject.clear()}},ln=class{constructor(e,t,n,r,i){this.publish=e,this.controlsManager=t,this.animationControls=n,this.eventContext=r,this.sharedVariables=i,this.isEnabled=!1,this.activateCount=0,this.needsMouse=!1,this.needsRaycast=!1,this.onTouchMovePreventScroll=e=>{let t=window.parent!==window,n=document.documentElement.scrollHeight>document.documentElement.clientHeight||document.documentElement.scrollWidth>document.documentElement.clientWidth;(e.touches.length>1||this.preventTouchScroll||!1===t&&!1===n)&&e.preventDefault()},this.onMouseWheelPreventScroll=e=>{this.preventScroll&&e.preventDefault()},this.onMouseMove=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:e.buttons>0}},this.onMouseDown=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:!0}},this.onMouseUp=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:!1}},this.getMousePosition=e=>{let{domRect:t}=this.eventContext,{pageX:n,pageY:r}=e.touches?.length>0?e.touches[0]:e;return{x:n-(t.left+window.scrollX),y:r-(t.top+window.scrollY)}},this.stopRaycast=e.stopRaycast,this.preventScroll=e.preventScroll,this.preventTouchScroll=e.preventTouchScroll,this.hideCursor=e.hideCursor,this.requestRender=r.requestRender}warnMissingEventFeatures(){this.eventContext.page.traverseEntity(e=>{for(let t of e.dataPatched.events){if(!0===t.data.disabled)continue;let e=t.data.type;if(void 0!==this.handlers[e])continue;let n=Z[e];void 0!==n&&he(n,`a "${e}" event`)}})}activate(e=!1){if(this.isEnabled)return;this.isEnabled=!0,this.initializeActionsDependentStates(),this.needsMouse&&(this.eventContext.domElement.addEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.addEventListener("pointerdown",this.onMouseDown));let t={eventContext:this.eventContext,eventManager:this,sharedVariables:this.sharedVariables,needsMouse:this.needsMouse,needsRaycast:this.needsRaycast};this.handlers={};let n=(e,n)=>{let r=y(e);void 0!==r?this.handlers[e]=r(t):void 0!==n&&(this.handlers[e]=n())};n("Spline",()=>new f(this.eventContext)),n("VariableChange"),n("API"),n("WEBHOOK"),n("AIAssistantListener"),n("AIAssistantTrigger"),n("Conditional"),n("Start",()=>new on(this.eventContext,this)),n("Basic",()=>new en(this.eventContext,this,this.needsRaycast)),n("MouseHover"),n("Scroll"),n("Follow"),n("DragDrop"),n("LookAt"),n("Resize"),n("Textfields"),this.warnMissingEventFeatures();let{page:r,domElement:i}=this.eventContext;this.hideCursor&&(i.style.cursor="none"),r.traverseEntity(e=>{e.addEventListener("requestRender",this.requestRender)}),Object.values(this.handlers).forEach(e=>e.connect()),i.addEventListener("wheel",this.onMouseWheelPreventScroll),i.addEventListener("touchmove",this.onTouchMovePreventScroll),this.activateCount++,e||this.eventContext.sharedAssets.openAIRealtime?.connect()}deactivate(e=!1){if(!this.isEnabled)return;this.isEnabled=!1,this.eventContext.domElement.removeEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.removeEventListener("pointerdown",this.onMouseDown),this.eventContext.domElement.removeEventListener("pointerup",this.onMouseUp),this.eventContext.sharedAssets.mouseProperty=null,this.eventContext.sharedAssets.raycastProperty=null;let{page:t,domElement:n}=this.eventContext;n.style.cursor="",Object.values(this.handlers).forEach(e=>e.disconnect()),this.controlsManager.gameControl?.disposeActions(),this.controlsManager.disconnectEvents(),t.traverseEntity(e=>{e.removeEventListener("requestRender",this.requestRender),e.destroyedInAction=!1}),n.removeEventListener("touchmove",this.onTouchMovePreventScroll),n.removeEventListener("wheel",this.onMouseWheelPreventScroll),this.animationControls.onExitPlayMode(),e||this.eventContext.sharedAssets.openAIRealtime?.disconnect()}dispose(){this.deactivate(),Object.values(this.handlers).forEach(e=>e.dispose())}get isPaused(){return this.isEnabled}pause(){this.deactivate()}resume(){this.activate()}reset(){this.deactivate(!0),this.activate(!0),this.controlsManager.deactivate(),this.controlsManager.activate(this),this.controlsManager.page.updateMatrixWorld(!0),this.controlsManager.rebuildBVH()}updateUseWindowEvents(e){let t=this.isEnabled;t&&this.deactivate(),this.eventContext.useWindowEvents=e,t&&this.activate()}initializeActionsDependentStates(){let e=this.eventContext.sharedAssets;e.resetDynamicVariablePlayState();let t=n=>{if("Conditional"===n.data.type&&(n.data.ifActions.forEach(t),n.data.elseActions.forEach(t)),"Conditional"===n.data.type||"SetVariable"===n.data.type)for(let e of"Conditional"===n.data.type?n.data.condition:n.data.expression)"id"in e&&Array.isArray(e.id)&&("mouse"===e.id[0]&&(this.needsMouse=!0),"raycast"===e.id[0]&&(this.needsRaycast=!0));"DynamicVariablePlay"===n.data.type&&""!==n.data.variableId&&("Play"===n.data.mode||"PlayPause"===n.data.mode||"Toggle"===n.data.mode)&&e.setDynamicVariablePlayState(n.data.variableId,"Stopped")};this.eventContext.page.traverseEntity(e=>{if(e.data?.events.length)for(let n of e.data.events)if("VariableChange"===n.data.type&&("mouseProperty"===n.data.variableId&&(this.needsMouse=!0),"raycastProperty"===n.data.variableId&&(this.needsRaycast=!0)),"Conditional"===n.data.type)for(let e of["inActions","outActions"])n.data[e].forEach(t);else if("DragDrop"===n.data.type)for(let e of["drag","drop"])n.data.dragDropActions[e].forEach(t);else if("GameControl"===n.data.type)for(let e of["idle","move","jump","run"])n.data.gameActions[e].forEach(t);else if("Resize"===n.data.type)for(let e of n.data.breakpoints)e.data.actions.forEach(t);else"LookAt"===n.data.type||"API"===n.data.type||n.data.actions.forEach(t)})}},cn=class{constructor(e,t,n,r){this.enableResponsive=!1,this._renderer=e,this._camera=t,this._frameSize=(new $e).copy(n),this._fov=r??t.fov}set frameSize(e){this._frameSize.copy(e)}setRenderSize(e,t){this._renderSize=void 0===e||void 0===t?void 0:new $e(e,t)}updateRenderer(){if(!this._renderer)return;let e=this._renderSize??this._frameSize;this._renderer.setSize(e.x,e.y)}updateViewport(){if(!this._renderer||!this._camera||"PerspectiveCamera"!==this._camera.cameraType)return;let e=this._renderSize??this._frameSize;this._renderer.setViewport(0,0,e.x,e.y)}updateCamera(){!this._camera||("PerspectiveCamera"===this._camera.cameraType?(this._camera.aspect=this._frameSize.x/this._frameSize.y,this._camera.updateProjectionMatrix()):this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y,this.enableResponsive))}setCamera(e){this._camera=e,this._fov=e.fov}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t,this.enableResponsive),this._camera.updateProjectionMatrix())}},hn=["particles","hair","shape-blends","vector-shapes","3d-paths","cloners","components","text","ui-2d","game-controls","collision-bvh","transitions"];function dn(e,t){if("Page"===e.type){let n=e.timelines;(void 0===n||Object.keys(n).length>0)&&t.add("timeline")}switch(e.type){case"Particle":case"ParticleCollider":t.add("particles");break;case"Hair":t.add("hair");break;case"Page":{null!=e.publish?.gameControlObject&&t.add("game-controls"),(null!=e.uiScene||void 0!==e.uiFrame)&&t.add("ui-2d");let n=e.uiScene?.objects;if(void 0!==n){if("function"!=typeof n.traverse)throw new Error("unrecognized uiScene shape");n.traverse((e,n)=>{dn(n,t)})}break}}switch(e.geometry?.type){case"ShapeBlendGeometry":t.add("shape-blends");break;case"VectorGeometry":t.add("vector-shapes");break;case"PathGeometry":t.add("3d-paths");break;case"UIGeometry":t.add("ui-2d");break;case"TextGeometry":case"InputGeometry":t.add("text")}("Component"===e.type||"Instance"===e.type)&&t.add("components"),null!=e.cloner&&t.add("cloners");let n=e.states;if(null!=n)if(Array.isArray(n))n.length>0&&t.add("transitions");else{if("object"!=typeof n)throw new Error("unrecognized states shape");Object.keys(n).length>0&&t.add("transitions")}}function un(e,t){if(e&&(e.data&&dn(e.data,t),e.children))for(let n of e.children)un(n,t)}var pn,mn,fn=class{get sharedAssets(){return this.shared}constructor(e,t={},n=!0,{dedupeParametricGeometries:r=!1}={}){this.shared=new W(e.shared,t,!0,n),this.shared.geometryCache.dedupeByValue=r,this.scene=new a(e.scene,this.sharedAssets),this.shared.setEntityOpContext({scene:this.scene,shared:this.shared})}reset(e,t){this.scene.clearScene(),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}resetPersonalCameraFromDocumentData(){for(let e of this.scene.children)e instanceof x&&!e.uiScene&&e.personalCamera.updateState(e.data.camera,{scene:this.scene,shared:this.shared})}dispose(){this.scene.dispose(),this.shared.dispose()}gc(){this.scene.releaseInstanceGroups(),this.shared.geometryCache.startGc(),this.shared.geometryCache2.startGc(),this.scene.traverseEntity(e=>{e instanceof H&&e.markGeometryAsReachable(this.shared)}),this.shared.geometryCache.endGc(),this.shared.geometryCache2.endGc()}},vn="vertexOrder";function yn(e){return mn||(mn=import("./runtime-DRACOLoader-SDMMLQLV.js").then(({DRACOLoader:t})=>((pn=new t).setDecoderPath(void 0!==e?`${e}/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload(),pn.decoderPending))),mn}async function gn(e){if(pn){let t,n={attributeIDs:{...pn.defaultAttributeIDs,[vn]:"GENERIC"},attributeTypes:{...pn.defaultAttributeTypes,[vn]:"Uint32Array"},useUniqueIDs:!1};try{t=await pn.decodeGeometry(new Int8Array(e).buffer,n)}catch(e){console.error(e)}if(t)return function(e){let t=e.attributes.find(e=>e.name===vn);if(!t)return e;let n=t.array,r=n.length,i=0;for(let e=0;e<r;e++)i=Math.max(i,n[e]+1);let s,a=e.attributes.filter(e=>e!==t).map(({name:e,itemSize:t,array:s})=>{let a=new Float32Array(i*t);for(let e=0;e<a.length;e++)a[e]=s[e%t];for(let e=0;e<r;e++){let r=n[e]*t,i=e*t;for(let e=0;e<t;e++)a[r+e]=s[i+e]}return{name:e,itemSize:t,array:a}});if(e.index){let t=e.index.array,r=new Uint32Array(t.length);for(let e=0;e<t.length;e++)r[e]=n[t[e]];s={array:r}}return{index:s,attributes:a}}({index:t.index?{array:t.index.array}:void 0,attributes:Object.entries(t.attributes).map(([e,t])=>({name:e,itemSize:t.itemSize,array:t.array}))})}return null}async function bn(e){for(let t of e){let e=await gn(t.geometry.data.draco);if(e){let n=t.geometry.data;e.index&&(n.index={array:e.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let r={};e.attributes.forEach(({name:e,array:t,itemSize:n})=>{r[e]={array:t,itemSize:n,type:"Float32Array",normalized:!1}}),n.attributes=r,n.draco=void 0}}}var wn={bloom:()=>import("./runtime-bloom-WOKMPZUM.js"),chromaticAberration:()=>import("./runtime-chromaticAberration-CJUJB3XW.js"),vignette:()=>import("./runtime-vignette-MCOLMAOU.js"),noise:()=>import("./runtime-noise-SMSEQDWF.js"),hueSaturation:()=>import("./runtime-hueSaturation-YLCXCGRL.js"),brightnessContrast:()=>import("./runtime-brightnessContrast-LAZS3J44.js"),depthOfField:()=>import("./runtime-depthOfField-G5EQM2NS.js"),pixelation:()=>import("./runtime-pixelation-IXZLOD7E.js")},En={bloom:()=>import("./runtime-fxBloom-J7DP6U3W.js"),depthOfField:()=>import("./runtime-fxDepthOfField-CGEBUOHG.js")};function _n(e,t,n){return Promise.all(e.map(e=>t[e]?.().catch(t=>{console.warn(`[spline] Failed to load the ${e} postprocessing effect (${n}); the effect will be skipped.`,t)}))).then(()=>{})}function jn(e){return _n(e,wn,"webgl")}var Pn=new WeakMap,Mn=new WeakMap;function Cn(e,t,n){let r=i=>{e.removeEventListener(t,r,!0),i.stopImmediatePropagation(),n(i)};return e.addEventListener(t,r,!0),()=>e.removeEventListener(t,r,!0)}var On=it(st(),1);function An(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function xn(e){return{id:e.uuid,name:e.name,type:e.object.data?.type??e.object.type,visible:!1!==e.playModeVisible,position:{x:e.position.x,y:e.position.y,z:e.position.z},rotation:{x:e.rotation.x*Fe.RAD2DEG,y:e.rotation.y*Fe.RAD2DEG,z:e.rotation.z*Fe.RAD2DEG},scale:{x:e.scale.x,y:e.scale.y,z:e.scale.z},spawned:!0}}function Sn(e){return{id:e.uuid,name:e.name,type:e.type??"Object",visible:e.visible,position:{x:e.position.x,y:e.position.y,z:e.position.z},rotation:{x:e.rotation.x*Fe.RAD2DEG,y:e.rotation.y*Fe.RAD2DEG,z:e.rotation.z*Fe.RAD2DEG},scale:{x:e.scale.x,y:e.scale.y,z:e.scale.z}}}function kn(e,n,r){let i=t=>e.findObjectById(t)??e.findObjectByName(t),s=new Map,a=e=>{let t=s.get(e);if(t)return t;for(let t of s.values())if(t.name===e)return t};return{setVariable:(t,n)=>t in e.getVariables()?(e.setVariable(t,n),{ok:!0}):{ok:!1,warning:`spline.setVariable: no variable named "${t}" in this scene.`},getVariable:t=>e.getVariable(t),getVariables:()=>e.getVariables(),getAllObjects:()=>e.getAllObjects().map(Sn),findObject:e=>{let t=i(e);return t?Sn(t):void 0},getGeometry:(e,t)=>{if(!r)return{warning:"spline.getGeometry: not available in this runtime integration."};let n=a(e),s=n?n.object:(()=>{let t=i(e);return t?r.findEntity(t.uuid):void 0})();if(!s)return{warning:`spline.getGeometry: no object named "${e}" (names/ids come from getAllObjects).`};let o,l=n??s;"world"===t.space&&(l.updateWorldMatrix?.(!0,!1),o=l.matrixWorld?.elements);let c=function(e,t){let n=e?.getAttribute("position");if(!n||!n.count)return null;let r=n.count,i=t??null,s=e.getIndex?.()??null,a=Math.floor((s?s.count:r)/3),o=1/0,l=1/0,c=1/0,h=-1/0,d=-1/0,u=-1/0,p=new Float32Array(3*r);for(let e=0;e<r;e++){let t=n.getX(e),r=n.getY(e),s=n.getZ(e);i&&([t,r,s]=Ft(i,t,r,s)),t<o&&(o=t),r<l&&(l=r),s<c&&(c=s),t>h&&(h=t),r>d&&(d=r),s>u&&(u=s),p[3*e]=t,p[3*e+1]=r,p[3*e+2]=s}let m={space:i?"world":"local",vertexCount:r,triangleCount:a,indexed:null!==s,bounds:{min:[o,l,c],max:[h,d,u],size:[h-o,d-l,u-c]},vertices:p};if(s){let e=new Uint32Array(s.count);for(let t=0;t<s.count;t++)e[t]=s.getX(t);m.indices=e}let f=e.getAttribute("normal");if(f&&f.count===r){let e=i?function(e){let t=e[0],n=e[4],r=e[8],i=e[1],s=e[5],a=e[9],o=e[2],l=e[6],c=e[10],h=t*(s*c-a*l)-n*(i*c-a*o)+r*(i*l-s*o);if(!isFinite(h)||Math.abs(h)<1e-12)return null;let d=1/h,u=[(s*c-a*l)*d,(r*l-n*c)*d,(n*a-r*s)*d,(a*o-i*c)*d,(t*c-r*o)*d,(r*i-t*a)*d,(i*l-s*o)*d,(n*o-t*l)*d,(t*s-n*i)*d];return[u[0],u[3],u[6],u[1],u[4],u[7],u[2],u[5],u[8]]}(i):void 0;if(!i||e){let t=new Float32Array(3*r);for(let n=0;n<r;n++){let r=f.getX(n),i=f.getY(n),s=f.getZ(n);if(e){let t=e[0]*r+e[1]*i+e[2]*s,n=e[3]*r+e[4]*i+e[5]*s,a=e[6]*r+e[7]*i+e[8]*s,o=Math.hypot(t,n,a);o>1e-12?(r=t/o,i=n/o,s=a/o):(r=t,i=n,s=a)}t[3*n]=r,t[3*n+1]=i,t[3*n+2]=s}m.normals=t}}let v=e.getAttribute("uv");if(v&&v.count===r){let e=new Float32Array(2*r);for(let t=0;t<r;t++)e[2*t]=v.getX(t),e[2*t+1]=v.getY(t);m.uvs=e}return m}(s.geometry,o);return c?{data:{id:l.uuid,name:l.name,geometry:s.data?.geometry?.type,...c}}:{warning:`spline.getGeometry: "${l.name}" has no readable geometry — only meshes do (lights, cameras and groups have none; read a group's child meshes instead).`}},updateObject:(t,n)=>{let s=a(t);if(s){let{position:t,rotation:r,scale:i,visible:a}=n;return t&&("number"==typeof t.x&&(s.position.x=t.x),"number"==typeof t.y&&(s.position.y=t.y),"number"==typeof t.z&&(s.position.z=t.z)),r&&("number"==typeof r.x&&(s.rotation.x=r.x*Fe.DEG2RAD),"number"==typeof r.y&&(s.rotation.y=r.y*Fe.DEG2RAD),"number"==typeof r.z&&(s.rotation.z=r.z*Fe.DEG2RAD)),i&&("number"==typeof i.x&&(s.scale.x=i.x),"number"==typeof i.y&&(s.scale.y=i.y),"number"==typeof i.z&&(s.scale.z=i.z)),"boolean"==typeof a&&(s.playModeVisible=a),s.updateMatrix(),e.requestRender(),!0}let o=i(t);if(!o)return!1;let{position:l,rotation:c,scale:h,visible:d,geometry:u,material:p}=n;if(u&&"object"==typeof u&&r){let e=r.findEntity(o.uuid);if(e){let{vertices:t,normals:n,uvs:i,indices:s,...a}=u;An(t)&&r.shared.updateEntityGeometryVertices(e,{vertices:t,normals:An(n)?n:void 0,uvs:An(i)?i:void 0,indices:An(s)?s:void 0}),Object.keys(a).length>0&&r.shared.updateEntityGeometryParams(e,a)}}if(p&&"object"==typeof p&&r){let e=r.findEntity(o.uuid);e&&r.shared.updateEntityMaterialParams(e,p)}return l&&("number"==typeof l.x&&(o.position.x=l.x),"number"==typeof l.y&&(o.position.y=l.y),"number"==typeof l.z&&(o.position.z=l.z)),c&&("number"==typeof c.x&&(o.rotation.x=c.x*Fe.DEG2RAD),"number"==typeof c.y&&(o.rotation.y=c.y*Fe.DEG2RAD),"number"==typeof c.z&&(o.rotation.z=c.z*Fe.DEG2RAD)),h&&("number"==typeof h.x&&(o.scale.x=h.x),"number"==typeof h.y&&(o.scale.y=h.y),"number"==typeof h.z&&(o.scale.z=h.z)),"boolean"==typeof d&&(o.visible=d),e.requestRender(),!0},createObject:async(t,n)=>Sn(await e.createObject(t,n)),createCustomMaterial:t=>e.createCustomMaterial(t),getTexture:(e,t)=>{if(!r)return null;let n=i(e),s=n?r.findEntity(n.uuid):void 0;if(!s)return null;let a=r.shared.getEntityTexture(s,t??{});return a?{texture:a.texture,width:a.width,height:a.height,layer:a.layerType}:null},setMaterial:(t,n)=>e.setMaterial(t,n),cloneObject:(t,n)=>Sn(e.cloneObject(t,n)),removeObject:t=>e.removeObject(t),spawnObject:(t,n)=>{if(!r)return{warning:"spline.spawnObject: not available in this runtime integration."};let a=i(t),o=a?r.findEntity(a.uuid):void 0;if(!o)return{warning:`spline.spawnObject: no object named "${t}" to use as a template.`};if(s.size>=500)return{warning:"spline.spawnObject: spawn budget reached (500 live copies) — destroyObject old copies (or reuse them) instead of spawning more."};let l=r.shared.spawnRuntimeClone(o,n??{});return l?(s.set(l.uuid,l),e.requestRender(),{object:xn(l)}):{warning:`spline.spawnObject: "${t}" cannot be spawned from.`}},destroyObject:t=>{let n=a(t);return!(!r||!n||(s.delete(n.uuid),r.shared.destroyRuntimeClone(n),e.requestRender(),0))},setInstanceTransforms:(t,n)=>{if(!r)return-1;let s=i(t),a=s?r.findEntity(s.uuid):void 0;if(!a)return-1;let o=r.shared.setEntityInstanceTransforms(a,n);return o>=0&&e.requestRender(),o},...t(()=>r?.getAnimationControls(),e=>{let t=i(e);return t?r?.findEntity(t.uuid):void 0}),emitEvent:(e,t,n)=>{let r=i(t);return r?(n?r.emitEventReverse(e):r.emitEvent(e),{ok:!0}):{ok:!1,warning:`spline.emitEvent: no object named "${t}".`}},requestRender:()=>e.requestRender(),addSplineEventListener:(t,n)=>{let r=e=>{n({target:{id:e.target?.id??"",name:e.target?.name??""}})};return e.addEventListener(t,r),()=>e.removeEventListener(t,r)},getCanvas:()=>n}}var Tn=class{constructor(e,t,n){this.iframe=e,this.bridge=t,this.observer=n}static mount(e,t,n,r){if(typeof document>"u")return null;let i=t.parentElement;if(!i)return null;"static"===getComputedStyle(i).position&&(i.style.position="relative");let s=document.createElement("iframe");s.setAttribute("sandbox","allow-scripts allow-forms allow-pointer-lock"),s.title="Spline HTML content";let a=s.style;a.position="absolute",a.border="0",a.background="transparent",a.pointerEvents="auto",a.colorScheme="normal";let o=()=>{a.left=`${t.offsetLeft}px`,a.top=`${t.offsetTop}px`,a.width=`${t.offsetWidth}px`,a.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(i),s.srcdoc=function(e){let t=`<script>${Wt}<\/script>`,n=/<head(\s[^>]*)?>/i.exec(e);if(n){let r=n.index+n[0].length;return e.slice(0,r)+t+e.slice(r)}let r=/<html(\s[^>]*)?>/i.exec(e);if(r){let n=r.index+r[0].length;return e.slice(0,n)+`<head>${t}</head>`+e.slice(n)}return t+e}(n),i.insertBefore(s,t.nextSibling);let c=new $t(s,kn(e,t,r),(e,t)=>{"warn"===e?console.warn(`[spline html] ${t}`):"error"===e&&console.error(`[spline html] ${t}`)});return c.attach(),new Tn(s,c,l)}dispose(){this.bridge.dispose(),this.observer.disconnect(),this.iframe.remove()}},Rn="data-spline-html-content",Dn=`\n[${Rn}] { pointer-events: none; }\n[${Rn}] > * { pointer-events: auto; }\n[${Rn}] [data-spline-passthrough] { pointer-events: none; }\n`,Ln=class{constructor(e,t,n,r,i,s){this.container=e,this.host=t,this.observer=n,this.spline=r,this.previousSplineGlobal=i,this.removeLateLifecycleShim=s}static mount(e,t,n,r){if(typeof document>"u")return null;let i=t.parentElement;if(!i)return null;"static"===getComputedStyle(i).position&&(i.style.position="relative");let s=document.createElement("div");s.setAttribute(Rn,"");let a=s.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${t.offsetLeft}px`,a.top=`${t.offsetTop}px`,a.width=`${t.offsetWidth}px`,a.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(i);let c=document.createElement("style");c.textContent=Dn,s.appendChild(c);let h=(new DOMParser).parseFromString(n,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let e of d)e.remove();for(let e of Array.from(h.head.children))("STYLE"===e.tagName||"LINK"===e.tagName&&"stylesheet"===e.rel)&&s.appendChild(e);for(;h.body.firstChild;)s.appendChild(h.body.firstChild);i.insertBefore(s,t.nextSibling),s.addEventListener("wheel",e=>{e.ctrlKey&&!e.defaultPrevented&&!t.dispatchEvent(new WheelEvent("wheel",e))&&e.preventDefault()},{passive:!1});let u=new Map,p=new Ht(kn(e,t,r),(e,t)=>{"warn"===e?console.warn(`[spline html] ${t}`):"error"===e&&console.error(`[spline html] ${t}`)},(e,t)=>{let n=u.get(e);if(n)for(let e of n)try{e(t)}catch(e){console.error(e)}}),m=(e,t)=>{try{return Promise.resolve(p.execute(e,t))}catch(e){return Promise.reject(e)}},f={ready:Promise.resolve(),setVariable:(e,t)=>m("setVariable",[e,t]),setVariables:e=>m("setVariables",[e]),getVariable:e=>m("getVariable",[e]),getVariables:()=>m("getVariables",[]),getAllObjects:()=>m("getAllObjects",[]),findObjectByName:e=>m("findObjectByName",[e]),findObjectById:e=>m("findObjectById",[e]),getGeometry:(e,t)=>m("getGeometry",[e,t??{}]),updateObject:(e,t)=>m("updateObject",[e,t]),createObject:(e,t)=>m("createObject",[e,t??{}]),createCustomMaterial:e=>m("createCustomMaterial",[e]),getTexture:(e,t)=>m("getTexture",[e,t??{}]),setMaterial:(e,t)=>m("setMaterial",[e,t]),cloneObject:(e,t)=>m("cloneObject",[e,t??{}]),removeObject:e=>m("removeObject",[e]),spawnObject:(e,t)=>m("spawnObject",[e,t??{}]),destroyObject:e=>m("destroyObject",[e]),setInstanceTransforms:(e,t)=>m("setInstanceTransforms",[e,t??null]),getAnimations:e=>m("getAnimations",[e]),playAnimation:(e,t,n)=>m("playAnimation",[e,t,n]),pauseAnimation:(e,t)=>m("pauseAnimation",[e,t]),stopAnimation:(e,t)=>m("stopAnimation",[e,t]),emitEvent:(e,t)=>m("emitEvent",[e,t]),emitEventReverse:(e,t)=>m("emitEventReverse",[e,t]),requestRender:()=>m("requestRender",[]),addEventListener:(e,t)=>{if("function"!=typeof t)return;let n=u.get(e);n||(n=new Set,u.set(e,n),m("listenEvent",[e])),n.add(t)},removeEventListener:(e,t)=>{let n=u.get(e);!n||(n.delete(t),0===n.size&&(u.delete(e),m("unlistenEvent",[e])))}},v=window.spline;window.spline=f;let y=function(){if(typeof document>"u"||"loading"===document.readyState)return()=>{};let e=[],t=(t,n)=>{let r=new Set,i=t.addEventListener.bind(t),s=t.removeEventListener.bind(t);Object.defineProperty(t,"addEventListener",{configurable:!0,writable:!0,value:(e,s,a)=>{if(i(e,s,a),!n.includes(e)||null==s)return;let o={type:e,listener:s};r.add(o),queueMicrotask(()=>{!r.delete(o)||((e,t,n)=>{let r=new Event(n);try{"function"==typeof t?t.call(e,r):t.handleEvent?.(r)}catch(e){console.error(e)}})(t,o.listener,o.type)})}}),Object.defineProperty(t,"removeEventListener",{configurable:!0,writable:!0,value:(e,t,n)=>{s(e,t,n);for(let n of r)n.type===e&&n.listener===t&&r.delete(n)}}),e.push(()=>{delete t.addEventListener,delete t.removeEventListener,r.clear()})};t(document,["DOMContentLoaded"]),t(window,["load"]);let n=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:e=>{"function"==typeof e&&queueMicrotask(()=>{try{e.call(window,new Event("load"))}catch(e){console.error(e)}})}}),e.push(()=>{n?Object.defineProperty(window,"onload",n):delete window.onload}),()=>{for(let t of e)t()}}();for(let e of d){let t=document.createElement("script");for(let n of Array.from(e.attributes))t.setAttribute(n.name,n.value);e.src?t.async=!1:t.textContent=e.textContent,s.appendChild(t)}return new Ln(s,p,l,f,v,y)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline===this.spline&&(window.spline=this.previousSplineGlobal)}};function Vn(e){return"object"==typeof e&&null!==e&&!0===e.isMaterial}function In(e){if("function"==typeof e.material)throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation — this entry point does not support it.");if(!Vn(e.material))return{options:e};let t=e.material;if(!0===t.isNodeMaterial){let n=G()?.NodeMaterial;if(void 0!==n&&t instanceof n)return{options:{...e,material:void 0},material:t};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => …) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, …).")}if(!0===t.isShaderMaterial)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend — port the shader to TSL with app.createCustomMaterial((three) => …), or use a built-in material (MeshStandardMaterial, …).");return{options:{...e,material:void 0},material:t}}var Gn=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),Un="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",Bn={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},Kn={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},Nn={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data — clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data — clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data — clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime — clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto — clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame — clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime — clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime — clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime — clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime — clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor — clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},Wn={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},zn={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function Hn(e,t){return void 0===e?[t[0],t[1],t[2]]:Array.isArray(e)?[e[0]??t[0],e[1]??t[1],e[2]??t[2]]:[e.x??t[0],e.y??t[1],e.z??t[2]]}function Fn(e){return"number"==typeof e?[e,e,e]:Hn(e,[1,1,1])}function $n(e){let t=new K(0,0,0,1);return t.setStyle(e),{r:t.r,g:t.g,b:t.b}}function qn(e,t){let n=e.material??(void 0!==e.color?{color:e.color}:void 0);if(void 0===n)return Re.defaultColorMaterial(Yn(Ke),"physical","layer1","layer2");if("string"==typeof n){for(let[e,r]of Object.entries(t.shared.materials))if(e===n||r.name===n)return e;if(function(e){let t=e.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)||/^(rgb|hsl)a?\(/.test(t)||void 0!==Je.NAMES[t]}(n))return Re.defaultColorMaterial($n(n),"physical","layer1","layer2");throw new Error(`createObject: material '${n}' matches no shared material in this document (available: ${function(e){let t=Object.entries(e.shared.materials).map(([,e])=>`'${e.name}'`).filter(e=>"'undefined'"!==e);return t.length?t.join(", "):"(none)"}(t)}) and is not a valid CSS color.`)}if("function"==typeof n)throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation — this entry point does not support it.");if(Vn(n))throw new Error("createObject: a three.js material instance cannot be stored in the document — this entry point does not support it.");let r=void 0!==n.color?$n(n.color):Yn(Ke),i=Re.defaultColorMaterial(r,"physical","layer1","layer2"),s=i.layers.find(e=>"light"===e.data.type);if(s){let e={};void 0!==n.roughness&&(e.roughness=n.roughness),void 0!==n.metalness&&(e.metalness=n.metalness),void 0!==n.reflectivity&&(e.reflectivity=n.reflectivity),Object.assign(s.data,e)}if(void 0!==n.alpha){let e=i.layers.find(e=>"color"===e.data.type);e&&Object.assign(e.data,{alpha:n.alpha})}return i}function Yn(e){return{r:(e>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255}}function Xn(e){let t=Ue.defaultData("TextGeometry"),{text:n,...r}=e,i=r.fontSize;return void 0!==i&&void 0===r.width&&(r.width=350*i/16),void 0!==i&&void 0===r.height&&(r.height=50*i/16),Object.assign(t,r),void 0!==n&&Object.assign(t,{text:{textValue:String(n)}}),t}function Zn(e){return Array.isArray(e)?e:!ArrayBuffer.isView(e)||e instanceof DataView?null:Array.from(e)}function Jn(e,t){return Yt({userData:{type:e,...L[e].normalizeInputs({parameters:t})}})}function Qn(e,t,n){let{objectType:r,geometryType:i}=e,s=function(e){let t={};for(let[n,r]of Object.entries(e))!Gn.has(n)&&void 0!==r&&(t[n]=r);return t}(t),a={states:new Te,events:new Te};if("Mesh"===r&&i){if("NonParametricGeometry"===i){let{geometry:e,doubleSide:r}=function(e){let t=Zn(e.vertices);if(!t||t.length<9||t.length%3!=0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let n=t.length/3;if(n>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${n}); keep it under 60000.`);let r=Zn(e.indices);if(r&&r.length){let e=r.find(e=>!Number.isInteger(e)||e<0||e>=n);if(void 0!==e)throw new Error(`createObject('CustomMesh'): index ${e} is out of range (mesh has ${n} vertices).`)}else r=null;let i=new nt;i.setAttribute("position",new tt(t,3));let s=Zn(e.normals),a=null!==s&&s.length===t.length;a&&i.setAttribute("normal",new tt(s,3));let o=Zn(e.uvs);o&&o.length===2*n&&i.setAttribute("uv",new tt(o,2));let l=!1;if(!a){let e=r??Array.from({length:n},(e,t)=>t),{closed:i,inverted:s}=function(e,t){let n=e.length/3,r=new Map,i=new Array(n);for(let t=0;t<n;t++){let n=`${Math.round(1e4*e[3*t])},${Math.round(1e4*e[3*t+1])},${Math.round(1e4*e[3*t+2])}`,s=r.get(n);void 0===s?(r.set(n,t),i[t]=t):i[t]=s}let s=new Map;for(let e=0;e+2<t.length;e+=3){let n=i[t[e]],r=i[t[e+1]],a=i[t[e+2]];for(let[e,t]of[[n,r],[r,a],[a,n]]){if(e===t)continue;let n=e<t?e+"_"+t:t+"_"+e;s.set(n,(s.get(n)??0)+1)}}let a=s.size>0;for(let e of s.values())if(2!==e){a=!1;break}if(!a)return{closed:!1,inverted:!1};let o=0;for(let n=0;n+2<t.length;n+=3){let r=3*t[n],i=3*t[n+1],s=3*t[n+2],a=e[r],l=e[r+1],c=e[r+2],h=e[i],d=e[i+1],u=e[i+2],p=e[s],m=e[s+1],f=e[s+2];o+=a*(d*f-u*m)+l*(u*p-h*f)+c*(h*m-d*p)}return{closed:!0,inverted:o<0}}(t,e);if(i&&s){for(let t=0;t+2<e.length;t+=3){let n=e[t+1];e[t+1]=e[t+2],e[t+2]=n}r=e}else i||(l=!0)}return r&&i.setIndex(r),a||i.computeVertexNormals(),{geometry:Yt({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:i.toJSON().data}),doubleSide:l}}(s);Object.assign(a,ze.defaultData,{geometry:e,materials:[qn(t,n)]}),r&&(a.side=2)}else Object.assign(a,ze.defaultData,{geometry:"TextGeometry"===i?Xn(s):Jn(i,s),material:qn(t,n)});void 0!==t.castShadow&&(a.castShadow=t.castShadow),void 0!==t.receiveShadow&&(a.receiveShadow=t.receiveShadow)}else"Empty"===r?Object.assign(a,We.defaultData):(Object.assign(a,me.defaultData(r),s),void 0!==t.color&&(a.color=$n(t.color)));a.visible=t.visible??!0,a.position=Hn(t.position,[0,0,0]),a.rotation=Hn(t.rotation,[0,0,0]),a.scale=Fn(t.scale);let o=(i&&Wn[i])??zn[r]??r;return a.name=t.name??er(o,n.scene.objects),a}function er(e,t){let n=new Set;if(t.traverse((e,t)=>{n.add(t.name??"")}),!n.has(e))return e;let r=2;for(;n.has(`${e} ${r}`);)r++;return`${e} ${r}`}function tr(e,t){let n=Fe.generateUUID();if("Component"===e.data.type)return{data:{...fe.fromComponentData(e),name:e.data.name+" Instance"},id:n,fi:e.fi,children:[]};t[e.id]=n;let r=e.data;return"Empty"===r.type&&r.animations?.length&&(r={...r,animations:je(r.animations,Fe.generateUUID,t)}),{...e,id:n,data:r,children:e.children.map(e=>tr(e,t))}}function nr(e){let t={},n=tr(e,t);return De(n,t)}function rr(e){let t=Array.isArray(e)?e[0]:e,n=t.layers?.map(ir)??[],r=t.layers?.find(e=>"light"===e.type);return{layers:n,alpha:r?.node.alphaOverride?.value??1}}function ir(e){return"texture"===e.type||"video"===e.type||"matcap"===e.type?{...e.data,updateTexture:t=>e.color.texture.image.updateSrc(t)}:{...e.data}}var sr=new K(0,0,0,1),ar={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]},or=new $e;function lr(e){let t=new K(0,0,0,1);try{t.setStyle(e)}catch(e){console.error(e)}return t}var cr=class{constructor(e,{renderOnDemand:t,renderMode:n="auto",wasmPath:r,renderer:i,htmlContentMode:s="sandbox"}={}){if(this._rendererBackend="webgl",this._rendererAuto=!1,this._rendererConfigured=!1,this._startOrder=0,this._claimedOrder=0,this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._htmlContentMode="sandbox",this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=e=>{if(this.time=e,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),this._renderer)if(this._isPaused||!("manual"===this.renderMode&&!this._renderRequested||"auto"===this.renderMode&&this._skipRender)){if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<B?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(e=>{"ParticleSystem"===e.type&&(e.update(this.dt),this._skipRender=!1),ie(e)&&(!0!==this._renderer?.isWebGPUSplineRenderer&&e.warnClassicFallbackOnce(),e.isSimulating&&(e.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let e=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=e,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),!0===this._renderer.lastFrameIncomplete&&(this._skipRender=!1),!0===this._renderer.skyAnimationActive&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()}else this._perfs?.end();else this._perfs?.end()},this._resize=e=>{if(this._renderer){if(1===this._viewportMode&&this._frameView&&(this._frameView.frameSize=or.set(this._viewportWidth,this._viewportHeight)),e){let e=this._viewportWidth,t=this._viewportHeight;this._renderer.setSize(e-1,t-1,!1),this._renderer.setSize(e,t,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera&&(this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(),"PerspectiveCamera"===this._camera.cameraType&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=ne(this._resize,10),this._onScroll=e=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=e,this._htmlContentMode=s,this.renderMode=t?"auto":n,void 0!==r&&(this._wasmPath=re(r,"/")),this._rendererBackend=i??"webgl",void 0===i){let e=null;try{e=new URLSearchParams(window.location.search).get("renderer")}catch{}"webgpu"===e||"webgl"===e||"webgl2"===e?this._rendererBackend="webgl2"===e?"webgl":e:(this._rendererAuto=!0,this._rendererBackend=typeof navigator<"u"&&"gpu"in navigator?"webgpu":"webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&import("./runtime-Perfs-KMJFDYHU.js").then(({Perfs:e})=>{this._perfs=new e({x:10,y:10})}),O(e)}async _ensureRenderer(){return this._renderer?this._renderer:(this._rendererInit||(this._rendererInit=this._initRenderer().then(e=>(this._rendererInit=void 0,e&&(this._renderer=e),e),e=>{throw this._rendererInit=void 0,e})),this._rendererInit)}async _initRenderer(){if(this.disposed)return null;let e=await this._createRenderer();return this.disposed?(this._disposeRenderer(e),null):e}_disposeRenderer(e){let t=function(e){let t=e.backend;if(void 0!==t)return!0===t.isWebGLBackend?t.gl??null:null;let n=e.getContext,r="function"==typeof n?n.call(e):null;return r&&"function"==typeof r.getExtension?r:null}(e);if(t&&!function(e,t){return Mn.get(e)===t}(this.canvas,this))return n=e,void(!0===n.backend?.isWebGLBackend||e.dispose());var n;let r=t?function(e,t){let n=t.getExtension("WEBGL_lose_context");if(!n||t.isContextLost())return()=>{};let r=()=>{},i=new Promise(t=>{r=Cn(e,"webglcontextlost",e=>{e.preventDefault(),t(n)})});return Pn.set(e,{gl:t,lost:i,stopListening:r}),()=>{t.isContextLost()||n.loseContext()}}(this.canvas,t):void 0;try{e.dispose()}finally{r?.()}}async _createRenderer(){if(e=this.canvas,t=this,Mn.set(e,this),await async function(e){let t=Pn.get(e);if(t&&(t.restoring??(t.restoring=async function(e,t){if(!t.gl.isContextLost())return void t.stopListening();let n,r=()=>{},i=t.lost.then(t=>new Promise(n=>{r=Cn(e,"webglcontextrestored",()=>n()),t.restoreContext()})),s=new Promise(e=>{n=setTimeout(e,2e3)});await Promise.race([i,s]),clearTimeout(n),r(),t.stopListening()}(e,t).finally(()=>{t.restoring=void 0,!t.gl.isContextLost()&&Pn.get(e)===t&&Pn.delete(e)})),await t.restoring,t.gl.isContextLost()))throw new Error("[spline] The browser did not restore the WebGL context this canvas had before dispose(); the scene cannot render on it. Use a new canvas.")}(this.canvas),"webgpu"===this._rendererBackend&&this._rendererAuto)try{await(navigator.gpu?.requestAdapter())||(this._rendererBackend="webgl")}catch{this._rendererBackend="webgl"}var e,t;if("webgpu"===this._rendererBackend)try{let{createWebGPUSplineRenderer:e,isWebGPUSupported:t}=await import("./runtime-webgpu-ET6ZHG3Z.js");t();let n=!0,r=!1;try{let e=new URLSearchParams(window.location.search),t=e.get("bundles");"rerecord"===t?n="rerecord":("off"===t||"0"===t||"false"===t||"no"===t)&&(n=!1),r="1"===e.get("forcegl")}catch{}let i=await e({canvas:this.canvas,antialias:!1,alpha:!0,powerPreference:"high-performance",sceneBundles:!r&&n,forceWebGL:r,asyncCompilation:this._asyncShaderCompilation()});return i.onBackgroundWorkReady=()=>{this._skipRender=!1,this._renderRequested=!0},i.skyAnimationAllowed=!0,i}catch(t){console.error("[spline] Failed to initialize the WebGPU renderer, falling back to WebGL:",t),this._rendererBackend="webgl"}{let{SplineRenderer:e,rendererGlobals:t}=await import("./runtime-classicRuntime-JUADSMET.js");try{"off"===new URLSearchParams(window.location.search).get("taa")&&(t.taaEnabled.value=!1)}catch{}return new e({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}}_asyncShaderCompilation(){let e=!1!==this._data?.scene.publish?.asyncShaderCompilation;try{let t=new URLSearchParams(window.location.search);if("1"===t.get("forcegl"))return!1;let n=t.get("asynccomp");"off"===n||"0"===n||"false"===n||"no"===n?e=!1:("on"===n||"1"===n||"true"===n||"always"===n)&&(e=!0)}catch{}return e}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let e=window.devicePixelRatio||1,t=this.canvas.clientWidth||300,n=this.canvas.clientHeight||150;this.canvas.width=t*e,this.canvas.height=n*e;let r=this.canvas.getContext("2d");r&&(r.scale(e,e),r.fillStyle="rgba(127, 127, 127, 0.85)",r.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",r.textAlign="center",r.textBaseline="middle",r.fillText("This scene requires a WebGPU-capable browser.",t/2,n/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(e,t,n){(function(e){let t="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";e.endsWith(".spline")?console.warn(t+" The .spline files are only meant to be used by the Editor."):e.endsWith(".splinecode")||console.warn(t)})(e),this.disposed=!1;{let e=()=>{};import("./runtime-updater-KLVUIFCT.js").catch(e),"webgpu"===this._rendererBackend?import("./runtime-webgpu-ET6ZHG3Z.js").catch(e):import("./runtime-classicRuntime-JUADSMET.js").catch(e)}let r=await(await fetch(e,n)).arrayBuffer();await this.start(r,{variables:t})}async start(e,t={}){if(this.disposed)return;let n,r=++this._startOrder,i=()=>this._claimedOrder>r;return n=this._start(e,t,i,()=>!i()&&(this._claimedOrder=r,this._claimedStart=n,!0)).then(()=>i()?this._claimedStart:void 0,e=>{if(!i())throw e;return this._claimedStart}),n}async _start(t,{interactive:n=!0,variables:r},a,l){p.init();let c=await async function(e){let[t,n]=Ie(Ge.deserialize(new Uint8Array(e)));if(135!==(t.schema??0)){let{updateDocumentSchema:e}=await import("./runtime-updater-KLVUIFCT.js");e(t)}return n.result().data}(t);if(a())return;let h=function(e){let t=[];return e.scene.objects.traverse((e,n)=>{"Mesh"===n.type&&"NonParametricGeometry"===n.geometry.type&&void 0!==n.geometry.data.draco&&t.push(n)}),t}(c);c.version&&(0,On.default)(c.version,"2.0.158")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),void 0!==this._wasmPath&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),He(this._wasmPath));let d=async function(e){{let t={particles:()=>import("./runtime-particles-YC55LAZE.js"),hair:()=>import("./runtime-hair-LM7K7ULP.js"),"shape-blends":()=>import("./runtime-shapeBlends-7YSQLV6W.js"),"vector-shapes":()=>import("./runtime-vectorShapes-CFS56WRE.js"),"3d-paths":()=>import("./runtime-paths-JH72VUYH.js"),cloners:()=>import("./runtime-cloners-CFYV6RIB.js"),components:()=>import("./runtime-components-73ZVG55O.js"),text:()=>import("./runtime-text-CC7PVEW4.js"),"ui-2d":()=>import("./runtime-ui2d-GRM5GCSY.js"),"game-controls":()=>import("./runtime-gameControls-LE4EHTAX.js"),"collision-bvh":()=>import("./runtime-collisionBVH-JA4BEOA7.js"),mousehover:()=>import("./runtime-mouseHover-PUKVQX75.js"),scroll:()=>import("./runtime-scroll-53LRLILO.js"),dragdrop:()=>import("./runtime-dragDrop-7AKEX5AU.js"),tracking:()=>import("./runtime-tracking-DAIX5CBO.js"),resize:()=>import("./runtime-resize-TSDCPHB2.js"),conditional:()=>import("./runtime-conditional-HIFTAHKC.js"),variables:()=>import("./runtime-variables-4DRZPW6M.js"),"api-services":()=>import("./runtime-apiServices-FVML63XU.js"),"ai-assistant":()=>import("./runtime-aiAssistant-54YBNKZT.js"),textinputs:()=>import("./runtime-textInputs-O4IPY3CW.js"),audio:()=>import("./runtime-audio-AU7AV2IM.js"),video:()=>import("./runtime-video-5AHDWGIY.js"),"create-destroy":()=>import("./runtime-createDestroy-JB4TBG77.js"),"scene-transition":()=>import("./runtime-sceneTransition-XSH52IGF.js"),timeline:()=>import("./runtime-timeline-VIZVAQRW.js"),transitions:()=>import("./runtime-transitions-B7STAPIR.js"),"misc-actions":()=>import("./runtime-miscActions-CHS3673K.js")},n=function(e){let t=new Set,n=!1,r=!1;for(let i of J(e,e=>{"GameControl"===e&&(n=!0),"Trigger"===e&&(r=!0)}))t.add(i);try{e.scene.objects.traverse((e,n)=>{dn(n,t)});let n=e.shared.lib?.components;if(n){let e=Object.keys(n);e.length>0&&t.add("components");for(let r of e)un(n[r]?.asset,t)}}catch{for(let e of hn)t.add(e)}return n&&t.add("game-controls"),(r||t.has("game-controls"))&&t.add("collision-bvh"),t}(e);await Promise.all([...n].map(e=>t[e]()))}}(c);if(await Promise.all([d,h.length&&yn(this._wasmPath),S(c)&&te(this._wasmPath),q(c)&&$(this._wasmPath),R(c)&&D(this._wasmPath),be.physicsEnabled(c.scene.objects)&&E(this._wasmPath),F(c)&&g(),i(c)&&s(),X(c)&&Y(),b(c)&&d.then(()=>ue()?.loadHanaUIRUNTIME()),_(c)&&M(this._wasmPath)].filter(Boolean)),a()||h.length&&(await bn(h),a())||!l())return;this._data=c,this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let m=c.scene.publish.renderer;if(this._rendererAuto&&"webgl"===m)this._rendererBackend="webgl";else if(this._rendererAuto&&"webgpu"===m){let e="webgpu"===this._rendererBackend&&await(navigator.gpu?.requestAdapter().catch(()=>null));if(a())return;if(!e)return void this._failWebGPURequired();this._rendererAuto=!1}let f=function(e){let t=new Set;return e.scene.objects.traverse((e,n)=>{if("Page"!==n.type)return;let r=n.postprocessing;if(r&&"object"==typeof r&&!0===r.enabled)for(let[e,n]of Object.entries(r))"enabled"!==e&&n&&"object"==typeof n&&!0===n.enabled&&t.add(e)}),[...t]}(c);if("webgpu"===this._rendererBackend)try{await Promise.all([import("./runtime-webgpu-ET6ZHG3Z.js"),(v=f,_n(v,En,"webgpu"))]);let e=await this._ensureRenderer();if(a()||!e)return}catch(e){console.error("[spline] Failed to load the WebGPU material backend, using WebGL:",e),this._rendererBackend="webgl"}var v;if("webgpu"!==this._rendererBackend&&(await Promise.all([import("./runtime-classicRuntime-JUADSMET.js"),jn(f)]),a()))return;V("webgpu"===this._rendererBackend?"webgpu":"webgl");let y=new fn(c,{},!0,{dedupeParametricGeometries:!0});if(y.resetPersonalCameraFromDocumentData(),this._scene=y.scene,this._sharedAssetsManager=y.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:e}=await import("./runtime-mergeStaticGeometries-INGAUYKH.js");if(a())return;let t=performance.now();e(c,y.scene);let n=performance.now();console.log("Merged geometries in ",n-t," ms")}S(c)&&this._scene.traverse(e=>{T(e)&&e.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(e=>{le(e)&&e.pendingMediaLoad&&e.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(e=>{"ParticleSystem"===e.type&&(e.wakeUp(),e.data.autoPlay?e.start():e.stop()),ie(e)&&e.setPlayMode(!0)});let w=Object.keys(c.shared.fonts).flatMap(e=>{let t=this._sharedAssetsManager.getFont(e);return t?[t.loadingPromise]:[]});if(Promise.all(w).then(()=>{this.disposed||(y.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),F(c)&&j(c)&&(await Promise.all(w),a()))return;if(b(c)){let e=[];if(this._scene.traverseEntity(t=>{(oe(t)||t instanceof x)&&t.uiCanvas&&e.push(t.uiCanvas)}),await Promise.all(e.map(e=>e.promise)),a())return}this._scene.rewriteEventsBeforeGoToPlayMode(),o(this._scene.activePage,this._sharedAssetsManager);let C=await this._ensureRenderer();if(a()||!C)return;if(this._rendererConfigured||(this._rendererConfigured=!0,C.pipeline.enableUIOverlay(),C.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode)),C.hdTransmission=!0===c.scene.publish.hdTransmission,C.setPixelRatio(this._getPixelRatio(/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?c.scene.publish.settings.web.pixelRatioMobile:c.scene.publish.settings.web.pixelRatioDesktop)),C.setAsyncCompilationPolicy?.(this._asyncShaderCompilation()),c.shared.images.SplineWatermark){let e=this._sharedAssetsManager.getImage("SplineWatermark");if(await e.loadPromise,a())return;let t=e.getTexture(1001);C.pipeline.setWatermark(t)}else C.pipeline.setWatermark(null);i(c)&&this._scene.initializeSplatViewer(),void 0!==c.scene.blueNoiseTextureData&&C.pipeline.updateBlueNoiseTexture(c.scene.blueNoiseTextureData);let O=Object.values(c.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):("fullscreen"===O.preset?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=O.size[0],this._viewportHeight=O.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),C.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new cn(C,this._camera,new $e(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(O.allowResponsive??!1)&&"fullscreen"===O.preset),n){let t=new u(C,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,O);this._scene.updateMatrixWorld(!0),this._controls=new P(t),this._animationControls=new e(this._scene,this._requestRenderAutoMode),this._eventManager=new ln(c.scene.publish,this._controls,this._animationControls,t,c.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),void 0!==r&&this.setVariables(r),0===this.dt&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),n&&(this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0);let A=c.scene.publish.htmlContent?.html;if(n&&A&&"none"!==this._htmlContentMode){let e={shared:this._sharedAssetsManager,findEntity:e=>this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e),getAnimationControls:()=>this._animationControls};this._htmlContentOverlay=("inline"===this._htmlContentMode?Ln.mount(this,this.canvas,A,e):Tn.mount(this,this.canvas,A,e))??void 0}}setVariables(e){if(void 0!==this._data){let t=Object.entries(e);for(let[e,n]of t)this.setVariable(e,n)}}setVariable(e,t){let n=this._getVariableByName(e);if(n&&!("dynamicVariableType"in n.data)){if(null==t)return void console.warn(`Variable ${e} was not updated: received ${t}. Pass a number, boolean or string.`);let r=t;if("number"==typeof n.data.value){if(r="number"==typeof t?t:"boolean"==typeof t?!0===t?1:0:parseFloat(t),!Number.isFinite(r))return void console.warn(`Variable ${e} is a number variable and ${JSON.stringify(t)} cannot be converted to a number. The variable was not updated.`)}else"boolean"==typeof n.data.value?r="number"==typeof t?!!t:"boolean"==typeof t?t:"false"!==t.toLocaleLowerCase()&&!!t:"string"!=typeof n.data.value&&void 0!==n.data.value.textValue&&(r=t.toString());let i="string"==typeof r?{textValue:r}:r;this._sharedAssetsManager?.updateVariable(n.id,i),this.requestRender(),this._requestRenderAutoMode()}else void 0===n?console.warn(`No variable named ${e} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in n.data&&console.warn(`Dynamic variables like ${e} cannot be updated from code.`)}getVariables(){let e={};return this._data&&this._data.shared.variables.forEach(t=>{void 0===e[t.data.name]&&(e[t.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(t.id)))}),e}getVariable(e){let t=this._getVariableByName(e);if(t){let e=this._sharedAssetsManager.getVariable(t.id);return this._getVariableValue(e)}}_getVariableValue(e){return"string"!=typeof e&&Ee.isTextValue(e)?Ee.getDisplayedValue(e):e}_getVariableByName(e){if(this._data){if(this._variablesCache.has(e))return this._variablesCache.get(e);let t=this._data.shared.variables.find(t=>t.data.name===e);return t&&this._variablesCache.set(e,t),t}}_getPixelRatio(e){switch(e){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(e){let t=this._scene?.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){let t=this._scene?.getObjectByName(e);return this._createProxyObject(t)}getAllObjects(){let e=[];return this._scene?.traverseEntity(t=>{if(!(t.uuid===Be||this._scene.isInvisibleObjects(t)||t instanceof x)){let n=this._createProxyObject(t);n&&e.push(n)}}),e}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEvent(e)}emitEventReverse(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEventReverse(e)}addEventListener(e,t){this.canvas.addEventListener(e,t)}removeEventListener(e,t){this.canvas.removeEventListener(e,t)}setZoom(e){this._controls?.orbitControls instanceof w&&this._controls?.orbitControls.setZoom(e)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(e,t){this._viewportWidth=e,this._viewportHeight=t,this._viewportMode=2,this._resize()}setBackgroundColor(e){let t=lr(e);this._scene?.activePage.setBackgroundColor(t),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._claimedOrder=++this._startOrder,this._claimedStart=void 0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,N(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(e=>{Kt.unsubscribe(e)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer&&this._disposeRenderer(this._renderer),this._renderer=void 0,this._rendererConfigured=!1,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),void 0!==this._resizeObserverTimeout&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,A(this.canvas),document.removeEventListener("scroll",this._onScroll),p.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(e){this._eventManager?.updateUseWindowEvents(e)}get data(){return this._data}_createProxyObject(e){if(!this._scene)return;let t,i=this._scene;if(null==e)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);e.traverseAncestors(e=>{e instanceof x&&(t=e.name)});let s=this._sharedAssetsManager,o={shared:s,scene:this._scene},l=t=>{if(null===t||"Base State"===t)return null;if(t&&e.data.states){let n=e.data.states.find(e=>e.data.name===t);return n?n.id:void 0}},c="material"in e?e.material:void 0,h=e.materialOverride,d={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,type:e.data.type,page:t,material:h??(c?rr(c):void 0),parentUuid:e.parent instanceof x||e instanceof a?void 0:e.parent?.uuid,emitEvent(t){e.dispatchEvent({type:"userEvent",eventName:t})},emitEventReverse(t){e.dispatchEvent({type:"userEvent",eventName:t,reverse:!0})},hide(){e.visible&&(e.visible=!1,o.shared.requestRender())},show(){e.visible||(e.visible=!0,o.shared.requestRender())},get state(){let t=e.stateSelection;if(null!==t)return e.data.states.find(({id:e})=>e===t)?.data.name},set state(t){let n;if(void 0!==t){let r="string"==typeof t?e.data.states.find(({id:e})=>e===t):e.data.states[t];if(r)n=r.id;else{let e="string"==typeof t?l(t):void 0;e&&(n=e)}}e.changeSelectedState(n??null,o),e.currentState=n??null,e.dispatchEvent({type:"completeState",state:n??null}),o.shared.requestRender()},transition(t){let a=n();if(null===a)return he("transitions","obj.transition()"),{transition(e){return this},play(){return this},pause(){return this},reset(){return this},seek(e){return this}};let o,c,h=this,d=[],u=!1,m=()=>{c=new r({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},d.map(e=>e.runner))},f={update(e){c?.update(e),!0!==c?.isPlaying&&p.remove(f)}},v={transition({from:t,to:n,duration:r,delay:c,...u}){let p=l(t);void 0===p&&(p=o);let f=l(n);return o=f,d.push(new a(e,p,f,{state:f,repeat:0,delay:c??0,delayDirection:"start-once",direction:"normal",duration:r??1e3,...u,...6===u.easing?ge.defaultData:5===u.easing?we.defaultData:{}},s,!1,i.activePage,{onBegin:()=>{(t&&p||"Base State"===t&&!p)&&(h.state=p??void 0)},onComplete:()=>{h.state=f??void 0}})),m(),this},play(){return c?(u=!0,c.play(p.time),c.isPlaying&&p.add(f),this):this},pause(){return c?.stop(),p.remove(f),this},reset(){return this.pause(),u=!1,m(),c?.seek(0),this},seek(e){let t=d.reduce((e,t)=>e+t.runner.duration,0);return t>0&&c?.seek(e/1e3/t),this}};return v.transition(t),(t.autoPlay??!0)&&queueMicrotask(()=>{u||v.play()}),v},set color(t){let n=lr(t);if(k.is(e))return void(e.color=n);if(!("Mesh"===e.type&&"material"in e&&e instanceof z))return;let r={r:n.r,g:n.g,b:n.b,a:n.a},i=e.materialOverride;if(void 0!==i){let e=i.color;return void(!0===e?.isColor&&"function"==typeof e.setStyle&&(e.setStyle(t),o.shared.requestRender()))}let s=Array.isArray(e.material)?e.material[0]:e.material,a=s.data.layers.find(e=>"color"===e.data.type)?.id;if(a)s.updateByOp({type:0,path:["layers",a],props:{color:{...r}}},s.data,o);else{let e=s.data,t=e.layers.find(e=>"light"===e.data.type);if(!t)return;let n=0===e.layers.indexOf(t)?t:null,i=e.layers.at(n?e.layers.indexOf(n)+1:0),a={type:4,fi:n?n.fi+(i?(i.fi-n.fi)/2:1):i?i.fi/2:1,id:Fe.generateUUID(),data:{...ke.defaultData("color"),color:r},localIndex:0},l=e.layers.insertAfterHelper(n?.id??null,1),c=e.layers.runOp({...a,fi:l[0]}).data;Object.assign(s.data,{layers:c}),s.updateByOp({...a,path:["layers"]},s.data,o)}}},u=Kt(d,(t,n)=>{let r=e[t],i=t.split(".");"material"===i[0]&&c&&void 0===h&&function(e,t,n){let r=Array.isArray(n)?n[0]:n;if("layers"===e[0]){let n=parseInt(e[1]),i=r.layers[n],s=e[2];i&&s&&function(e,t,n){let r=e[0];try{if(function(e,t){return!!ar[t]?.includes(e)}(r,n.type,e.slice(1)))if("colors"===r){if(e.length<2)throw new Error("You cannot mutate the colors array, only its items");let i=parseInt(e[1]),s=n.getValue(r)?.[i];if(!s)throw new Error("Color index out of range");sr.setStyle(t),s.set(sr.r,sr.g,sr.b,sr.a)}else n.getValue(r)?.setStyle(t);else if("texture"===r||"video"===r){let r=n.color;!function(e,t,n,r){let i=e[0];if("repeat"===i||"offset"===i||"rotation"===i){let n=r.getNode("mat"),s=n&&"function"==typeof n.updateMatrix?n:r.getValue("mat");if(!s)return;if("rotation"===i)s.rotation=parseFloat(t);else{let n=e[1];if(void 0===n)t instanceof Array&&2===t.length&&Object.assign(s,{[i]:t});else{let e=s[i],r=0===parseInt(n)?[parseFloat(t),e[1]]:[e[0],parseFloat(t)];Object.assign(s,{[i]:r})}}s.updateMatrix()}else"wrapping"===i||"minFilter"===i||"magFilter"===i?"wrapping"===i?n.texture.wrap=t:n.texture[i]=t:"image"===i&&"data"===e[1]&&n.texture.image.updateSrc(t)}(e.slice(1),t,r,n)}else{let i=e[1],s=n.getValue(r);s?.isVector3&&void 0!==i||s?.isVector2&&void 0!==i?s.setComponent(parseInt(i),t):n.setValue(r,t)}}catch(e){console.error("Error setting material value",e)}}(e.slice(2),t,i)}else"alpha"===e[0]&&r.layers.forEach(e=>{"light"===e.type&&void 0!==e.node.alphaOverride&&(e.node.alphaOverride.value=t,t<1&&(r.transparent=!0))})}(i.slice(1),n,c),"object"!=typeof r&&Object.getOwnPropertyDescriptor(e,t)?.writable&&(e[t]=n),this._requestRenderAutoMode(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,u),u}setUIWasmUrl(e){de(e)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(e,t){let n;if("string"==typeof t){if(!t.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let e=await(await fetch(t)).arrayBuffer();n=new Uint8Array(e)}}else n=t;let r=Ge.deserialize(n),i="data"in r&&void 0!==r.data.draco;i&&await yn(this._wasmPath);let s=this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e);if(!s)return void console.warn(`Object ${e} not found`);if("Mesh"!==s.data.type||!(s instanceof z))return void console.warn(`Object ${e} is not a mesh`);let a=s,o={...a.data,geometry:r};i&&await bn([o]),a.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let e of a.data.states){let t={...e.data};a.states||(a.states={}),a.states[e.id]=ye.patch(o,t)}return n}_applyDocumentTransaction(e){this._data=e.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let t of e.actual){let e=t.path;Array.isArray(e)&&2===e.length&&"scene"===e[0]&&"objects"===e[1]&&this._scene?.updateTreeByOp({...t,path:[]},this._sharedAssetsManager)}}_findEntity(e){return this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e)}_resolveParentId(e){if(void 0===e)return this._scene.activePage.uuid;let t="string"==typeof e?e:e.uuid,n=this._findEntity(t);if(!n)throw new Error(`parent '${t}' — no object with that name or uuid in the scene.`);return n.uuid}async createCustomMaterial(e){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if("function"!=typeof e)throw new Error("createCustomMaterial: expected a factory function — createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let t=G();if(void 0===t&&("webgpu"===this._rendererBackend&&(await import("./runtime-webgpu-ET6ZHG3Z.js"),t=G()),void 0===t))throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline — pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let n=e(t);if("object"!=typeof n||null===n||!0!==n.isMaterial)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives — e.g. (three) => new three.MeshStandardNodeMaterial().");return n}async setMaterial(e,t){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let n=this._scene;if(!n)throw new Error("setMaterial: no scene loaded — call load() or start() first.");let r="string"==typeof e?e:e.uuid,i=this._findEntity(r);if(!i)throw new Error(`setMaterial: '${r}' — no object with that name or uuid in the scene.`);if(!(i instanceof z))throw new Error(`setMaterial: '${r}' is not a mesh — lights, groups, and cameras have no material.`);let s="function"==typeof t?await this.createCustomMaterial(t):t;if("webgpu"!==I())throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline — pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=In({material:s});if(void 0===a.material)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return i.setMaterialOverride(a.material,{scene:n,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(i.uuid),this._requestRenderAutoMode(),a.material}async createObject(e,t={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let n=this._scene,r=this._data;if(!n||!r)throw new Error("createObject: no scene loaded — call load() or start() first.");let i=function(e){if("string"!=typeof e||0===e.length)throw new Error(`createObject: expected a type name string — one of ${Un}.`);let t=e.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),n=Kn[t];if(n)return{objectType:n};let r=Bn[t];if(r)return{objectType:"Mesh",geometryType:r};let i=Nn[t];throw i?new Error(`createObject: '${e}' is not supported — ${i}`):new Error(`createObject: '${e}' is not a creatable Spline type — use one of ${Un}, e.g. createObject('Cube', { width: 200 }).`)}(e);"function"==typeof t.material&&(t={...t,material:await this.createCustomMaterial(t.material)});let s,a,{options:o,material:l}=In(t);if(void 0!==l){if("Mesh"!==i.objectType)throw new Error("createObject: a three.js material instance only applies to mesh types — lights and groups have no material.");if("webgpu"!==I())throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline — pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}if("TextGeometry"===i.geometryType){if(await import("./runtime-text-CC7PVEW4.js"),!ce("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature — re-export the scene with a Text object present, or load the full runtime build.");if(await g(),a=t.font??Le,void 0===r.shared.fonts[a]){if(a!==Le){let e=Object.keys(r.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document — available fonts: ${e||"(none)"}.`)}s={name:Le,url:Ve}}}let c=this._resolveParentId(t.parent),h=Qn(i,o,r),d=Fe.generateUUID(),[u,p]=Ie(r);s&&(u.shared.fonts[Le]=s),u.scene.objects.insertAfter(c,null,[{id:d,data:h,children:[]}]);let m=p.result();if(s&&this._sharedAssetsManager.addFont(Le,s),void 0!==a){let e=this._sharedAssetsManager.getFont(a);e&&await e.loadingPromise}this._applyDocumentTransaction(m);let f=n.find(d);return void 0!==l&&f.setMaterialOverride(l,{scene:n,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(f)}cloneObject(e,t={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let n=this._scene,r=this._data;if(!n||!r)throw new Error("cloneObject: no scene loaded — call load() or start() first.");let i="string"==typeof e?e:e?.uuid,s=i?this._findEntity(i):void 0;if(!s)throw new Error(`cloneObject: '${i}' — no object with that name or uuid in the scene.`);if(s instanceof x)throw new Error("cloneObject: pages cannot be cloned.");let a=r.scene.objects.get(s.uuid);if(!a)throw new Error(`cloneObject: '${i}' is not part of the document tree (expanded clones and instanced children cannot be cloned — clone their source object instead).`);let o=function(e,t,n){let r={...e.data};return void 0!==t.position&&(r.position=Hn(t.position,[0,0,0])),void 0!==t.rotation&&(r.rotation=Hn(t.rotation,[0,0,0])),void 0!==t.scale&&(r.scale=Fn(t.scale)),void 0!==t.visible&&(r.visible=t.visible),r.name=t.name??er(`${e.data.name??"Object"} Copy`,n),{...e,data:r}}(nr(a),t,r.scene.objects),l=void 0!==t.parent?this._resolveParentId(t.parent):r.scene.objects.parent(s.uuid)??null,c=void 0!==t.parent?null:s.uuid,[h,d]=Ie(r);h.scene.objects.insertAfter(l,c,[o]),this._applyDocumentTransaction(d.result());let u=n.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(u)}removeObject(e){let t=this._scene,n=this._data;if(this.disposed||!t||!n)return!1;let r="string"==typeof e?e:e?.uuid,i=r?this._findEntity(r):void 0;if(!i)return!1;if(i instanceof x)throw new Error("removeObject: pages cannot be removed.");if("PerspectiveCamera"===i.data.type||"OrthographicCamera"===i.data.type)throw new Error("removeObject: cameras cannot be removed.");if(void 0===n.scene.objects.get(i.uuid))throw new Error(`removeObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let s=[];i.traverseEntity(e=>{s.push(e.uuid)});let[a,o]=Ie(n);a.scene.objects.delete(i.uuid),this._applyDocumentTransaction(o.result());for(let e of s){let t=this._proxyObjectCache.get(e);t&&(Kt.unsubscribe(t),this._proxyObjectCache.delete(e))}return this._requestRenderAutoMode(),!0}};export{cr as Application,Ne as Axis,ve as Easing,Pe as GradientType,pe as NoiseType,Se as PatternStyle,Oe as ProjectionType,_e as Side,Ce as TextureFilter,xe as ToonType,Ae as VoronoiStyle,Me as Wrapping};
|
|
1
|
+
import{c as e,d as t,f as n,g as r}from"./runtime-chunk-QH3OZHRR.js";import{c as i,d as s,f as a}from"./runtime-chunk-T2V3VIUH.js";import{a as o}from"./runtime-chunk-ZBHADU7F.js";import"./runtime-chunk-HD7WF3XN.js";import"./runtime-chunk-BOUH46YB.js";import{a as l,b as c,c as h,d,e as u}from"./runtime-chunk-B746A6R3.js";import{a as p}from"./runtime-chunk-GGSUJEGZ.js";import"./runtime-chunk-67JVRH4T.js";import{a as m,b as f}from"./runtime-chunk-NBYTQLIB.js";import{a as v,c as y}from"./runtime-chunk-DZNU62CT.js";import"./runtime-chunk-APVHFUEV.js";import{c as g}from"./runtime-chunk-T53JMQSH.js";import{a as b}from"./runtime-chunk-FTVQTRM7.js";import{a as w,b as E,e as _,h as j,j as P,m as M}from"./runtime-chunk-UQM7NEPK.js";import"./runtime-chunk-N2ZRGNPR.js";import{a as C,d as O,e as A}from"./runtime-chunk-VAVYZ35B.js";import"./runtime-chunk-FQNSP44B.js";import{h as x}from"./runtime-chunk-FAV6G64D.js";import"./runtime-chunk-WJPI7EAI.js";import{b as S,e as k,h as R}from"./runtime-chunk-POOKT2FW.js";import"./runtime-chunk-TU4KDRKR.js";import"./runtime-chunk-244LC6MP.js";import{a as T}from"./runtime-chunk-TFVTJVME.js";import"./runtime-chunk-RYJNVDUM.js";import"./runtime-chunk-GFMUAGIR.js";import"./runtime-chunk-O2KHHZMS.js";import{I as D,M as L,O as V,P as I,W as U,b as G,f as B,i as K,k as N,ka as z,na as W,oa as H,p as F,y as $,z as q}from"./runtime-chunk-DL4A3K5P.js";import"./runtime-chunk-4YV3EXSU.js";import{a as Y,b as X}from"./runtime-chunk-NSD7DU3P.js";import{c as Z,d as J,f as Q,g as ee}from"./runtime-chunk-UNI3D2MC.js";import{n as te}from"./runtime-chunk-7B2VPZYM.js";import{a as ne,h as re}from"./runtime-chunk-RTLL6WIB.js";import{b as ie,c as se,e as ae,f as oe,h as le}from"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-MOPA2GCL.js";import{b as ce,c as he,k as de,l as ue}from"./runtime-chunk-TZCHGFVF.js";import{$ as pe,Ba as me,Da as fe,F as ve,Fa as ye,G as ge,Ga as be,H as we,Ia as Ee,T as _e,Wa as je,X as Pe,Y as Me,Z as Ce,_ as Oe,aa as Ae,ba as xe,ca as Se,ea as ke,f as Re,fa as Te,g as De,ga as Le,ha as Ve,l as Ie,o as Ue,pa as Ge,w as Be,x as Ke,y as Ne,ya as ze,za as We}from"./runtime-chunk-ADHKZQMB.js";import{a as He}from"./runtime-chunk-OZLC437Q.js";import{Ec as Fe,Fc as $e,Gc as qe,Hc as Ye,Qc as Xe,Rc as Ze,Vc as Je,Zc as Qe,bd as et,dd as tt,fd as nt}from"./runtime-chunk-KPOUV3HD.js";import{a as rt,b as it}from"./runtime-chunk-ML3Z74BL.js";var st=rt((e,t)=>{t.exports=function(e,t){for(var n=e.split("."),r=t.split("."),i=0;i<3;i++){var s=Number(n[i]),a=Number(r[i]);if(s>a)return 1;if(a>s)return-1;if(!isNaN(s)&&isNaN(a))return 1;if(isNaN(s)&&!isNaN(a))return-1}return 0}}),at=".",ot=Symbol("target"),lt=Symbol("unsubscribe");function ct(e){return e instanceof Date||e instanceof Set||e instanceof Map||e instanceof WeakSet||e instanceof WeakMap||ArrayBuffer.isView(e)}var ht=Array.isArray;function dt(e){return"symbol"==typeof e}var ut={after:(e,t)=>ht(e)?e.slice(t.length):""===t?e:e.slice(t.length+1),concat:(e,t)=>ht(e)?(e=[...e],t&&e.push(t),e):t&&void 0!==t.toString?(""!==e&&(e+=at),dt(t)?e+t.toString():e+t):e,initial:e=>{if(ht(e))return e.slice(0,-1);if(""===e)return e;let t=e.lastIndexOf(at);return-1===t?"":e.slice(0,t)},last:e=>{if(ht(e))return e[e.length-1]||"";if(""===e)return e;let t=e.lastIndexOf(at);return-1===t?e:e.slice(t+1)},walk:(e,t)=>{if(ht(e))for(let n of e)t(n);else if(""!==e){let n=0,r=e.indexOf(at);if(-1===r)t(e);else for(;n<e.length;)-1===r&&(r=e.length),t(e.slice(n,r)),n=r+1,r=e.indexOf(at,n)}},get(e,t){return this.walk(t,t=>{e&&(e=e[t])}),e}};function pt(e,t,n){return e.isUnsubscribed||t.ignoreSymbols&&dt(n)||t.ignoreUnderscores&&"_"===n.charAt(0)||"ignoreKeys"in t&&t.ignoreKeys.includes(n)}var mt=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return void 0===this._descriptorCache&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let n=this._getProperties(e),r=n[t];return void 0===r&&(r=Reflect.getOwnPropertyDescriptor(e,t),n[t]=r),r}getProxy(e,t,n,r){if(this.isUnsubscribed)return e;let i=e[r],s=i||e;this._pathCache.set(s,t);let a=this._proxyCache.get(s);return void 0===a&&(a=void 0===i?new Proxy(e,n):e,this._proxyCache.set(s,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,ut.get(t,this.getPath(e)))}defineProperty(e,t,n){return!!Reflect.defineProperty(e,t,n)&&(this.isUnsubscribed||(this._getProperties(e)[t]=n),!0)}setProperty(e,t,n,r,i){if(!this._equals(i,n)||!(t in e)){let i=this._getOwnPropertyDescriptor(e,t);return void 0!==i&&"set"in i?Reflect.set(e,t,n,r):Reflect.set(e,t,n)}return!0}deleteProperty(e,t,n){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let r=this._getDescriptorCache().get(e);r&&(delete r[t],this._pathCache.delete(n))}return!0}return!1}isSameDescriptor(e,t,n){let r=this._getOwnPropertyDescriptor(t,n);return void 0!==e&&void 0!==r&&Object.is(e.value,r.value)&&(e.writable||!1)===(r.writable||!1)&&(e.enumerable||!1)===(r.enumerable||!1)&&(e.configurable||!1)===(r.configurable||!1)&&e.get===r.get&&e.set===r.set}isGetInvariant(e,t){let n=this._getOwnPropertyDescriptor(e,t);return void 0!==n&&!0!==n.configurable&&!0!==n.writable}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function ft(e){return"[object Object]"===toString.call(e)}function vt(){return!0}function yt(e,t){return e.length!==t.length||e.some((e,n)=>t[n]!==e)}var gt=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),bt=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),wt={push:vt,pop:vt,shift:vt,unshift:vt,copyWithin:yt,reverse:yt,sort:yt,splice:yt,flat:yt,fill:yt},Et=new Set([...gt,...bt,...Object.keys(wt)]);function _t(e,t){if(e.size!==t.size)return!0;for(let n of e)if(!t.has(n))return!0;return!1}var jt=["keys","values","entries"],Pt=new Set(["has","toString"]),Mt={add:_t,clear:_t,delete:_t,forEach:_t},Ct=new Set([...Pt,...Object.keys(Mt),...jt]);function Ot(e,t){if(e.size!==t.size)return!0;let n;for(let[r,i]of e)if(n=t.get(r),n!==i||void 0===n&&!t.has(r))return!0;return!1}var At=new Set([...Pt,"get"]),xt={set:Ot,clear:Ot,delete:Ot,forEach:Ot},St=new Set([...At,...Object.keys(xt),...jt]),kt=class{constructor(e,t,n,r){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=r,this._changes=r?[]:null,this.clone=void 0===t?e:this._shallowClone(e)}static isHandledMethod(e){return gt.has(e)}_shallowClone(e){let t=e;if(ft(e))t={...e};else if(ht(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(e=>this._shallowClone(e)));else if(e instanceof Map){t=new Map;for(let[n,r]of e.entries())t.set(n,this._shallowClone(r))}return this._clonedCache.add(t),t}preferredThisArg(e,t,n,r){return e?(ht(r)?this._onIsChanged=wt[t]:r instanceof Set?this._onIsChanged=Mt[t]:r instanceof Map&&(this._onIsChanged=xt[t]),r):n}update(e,t,n){let r=ut.after(e,this._path);if("length"!==t){let e=this.clone;ut.walk(r,t=>{e&&e[t]&&(this._clonedCache.has(e[t])||(e[t]=this._shallowClone(e[t])),e=e[t])}),this._hasOnValidate&&this._changes.push({path:r,property:t,previous:n}),e&&e[t]&&(e[t]=n)}this._isChanged=!0}undo(e){let t;for(let n=this._changes.length-1;-1!==n;n--)t=this._changes[n],ut.get(e,t.path)[t.property]=t.previous}isChanged(e){return void 0===this._onIsChanged?this._isChanged:this._onIsChanged(this.clone,e)}},Rt=class extends kt{static isHandledMethod(e){return Et.has(e)}},Tt=class extends kt{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}},Dt=class extends kt{static isHandledMethod(e){return Ct.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}},Lt=class extends kt{static isHandledMethod(e){return St.has(e)}undo(e){for(let[t,n]of this.clone.entries())e.set(t,n);for(let t of e.keys())this.clone.has(t)||e.delete(t)}},Vt=class extends kt{constructor(e,t,n,r){super(void 0,t,n,r),this._arg1=n[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}},It=class extends kt{constructor(e,t,n,r){super(void 0,t,n,r),this._weakKey=n[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}},Ut=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return ft(e)||ht(e)||ct(e)}static isHandledMethod(e,t){return ft(e)?kt.isHandledMethod(t):ht(e)?Rt.isHandledMethod(t):e instanceof Set?Dt.isHandledMethod(t):e instanceof Map?Lt.isHandledMethod(t):ct(e)}get isCloning(){return this._stack.length>0}start(e,t,n){let r=kt;ht(e)?r=Rt:e instanceof Date?r=Tt:e instanceof Set?r=Dt:e instanceof Map?r=Lt:e instanceof WeakSet?r=Vt:e instanceof WeakMap&&(r=It),this._stack.push(new r(e,t,n,this._hasOnValidate))}update(e,t,n){this._stack[this._stack.length-1].update(e,t,n)}preferredThisArg(e,t,n){let{name:r}=e,i=Ut.isHandledMethod(n,r);return this._stack[this._stack.length-1].preferredThisArg(i,r,t,n)}isChanged(e,t,n){return this._stack[this._stack.length-1].isChanged(e,t,n)}undo(e){void 0!==this._previousClone&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}},Gt={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},Bt=(e,t,n={})=>{n={...Gt,...n};let r=Symbol("ProxyTarget"),{equals:i,isShallow:s,ignoreDetached:a,details:o}=n,l=new mt(i),c="function"==typeof n.onValidate,h=new Ut(c),d=(e,t,r,i,s)=>!c||h.isCloning||!0===n.onValidate(ut.concat(l.getPath(e),t),r,i,s),u=(t,r,i,s)=>{!pt(l,n,r)&&(!a||!l.isDetached(t,e))&&p(l.getPath(t),r,i,s)},p=(e,n,r,i,s)=>{h.isCloning?h.update(e,n,i):t(ut.concat(e,n),r,i,s)},m=e=>e&&(e[r]||e),f=(t,i,o,c)=>function(e){return("object"==typeof e?null===e:"function"!=typeof e)||e instanceof RegExp}(t)||"constructor"===o||s&&!Ut.isHandledMethod(i,o)||pt(l,n,o)||l.isGetInvariant(i,o)||a&&l.isDetached(i,e)?t:(void 0===c&&(c=l.getPath(i)),l.getProxy(t,ut.concat(c,o),v,r)),v={get(e,t,n){if(dt(t)){if(t===r||t===ot)return e;if(t===lt&&!l.isUnsubscribed&&0===l.getPath(e).length)return l.unsubscribe(),e}let i=ct(e)?Reflect.get(e,t):Reflect.get(e,t,n);return f(i,e,t)},set(e,t,n,s){n=m(n);let a=e[r]||e,o=a[t];if(i(o,n)&&t in e)return!0;let c=d(e,t,n,o);return c&&l.setProperty(a,t,n,s,o)?(u(e,t,e[t],o),!0):!c},defineProperty(e,t,n){if(!l.isSameDescriptor(n,e,t)){let r=e[t];d(e,t,n.value,r)&&l.defineProperty(e,t,n,r)&&u(e,t,n.value,r)}return!0},deleteProperty(e,t){if(!Reflect.has(e,t))return!0;let n=Reflect.get(e,t),r=d(e,t,void 0,n);return r&&l.deleteProperty(e,t,n)?(u(e,t,void 0,n),!0):!r},apply(t,n,s){let a=n[r]||n;if(l.isUnsubscribed)return Reflect.apply(t,a,s);if((!1===o||!0!==o&&!o.includes(t.name))&&Ut.isHandledType(a)){let r=ut.initial(l.getPath(t)),o=Ut.isHandledMethod(a,t.name);h.start(a,r,s);let c=Reflect.apply(t,h.preferredThisArg(t,n,a),o?s.map(e=>m(e)):s),u=h.isChanged(a,i),y=h.stop();if(Ut.isHandledType(c)&&o&&(n instanceof Map&&"get"===t.name&&(r=ut.concat(r,s[0])),c=l.getProxy(c,r,v)),u){let n={name:t.name,args:s,result:c},i=h.isCloning?ut.initial(r):r,o=h.isCloning?ut.last(r):"";d(ut.get(e,i),o,a,y,n)?p(i,o,a,y,n):h.undo(a)}return(n instanceof Map||n instanceof Set)&&function(e){return"object"==typeof e&&"function"==typeof e.next}(c)?function(e,t,n,r,i){let s=e.next;if("entries"===t.name)e.next=function(){let e=s.call(this);return!1===e.done&&(e.value[0]=i(e.value[0],t,e.value[0],r),e.value[1]=i(e.value[1],t,e.value[0],r)),e};else if("values"===t.name){let a=n[ot].keys();e.next=function(){let e=s.call(this);return!1===e.done&&(e.value=i(e.value,t,a.next().value,r)),e}}else e.next=function(){let e=s.call(this);return!1===e.done&&(e.value=i(e.value,t,e.value,r)),e};return e}(c,t,n,r,f):c}return Reflect.apply(t,n,s)}},y=l.getProxy(e,n.pathAsArray?[]:"",v);return t=t.bind(y),c&&(n.onValidate=n.onValidate.bind(y)),y};Bt.target=e=>e&&e[ot]||e,Bt.unsubscribe=e=>e[lt]||e;var Kt=Bt,Nt="__splineHtmlContent",zt=`(function () {\n\t'use strict';\n\tvar MARKER = ${JSON.stringify(Nt)};\n\tvar callSeq = 1;\n\tvar pending = {};\n\tvar listeners = {};\n\tvar acked = false;\n\tvar readyResolve;\n\tvar readyPromise = new Promise(function (resolve) { readyResolve = resolve; });\n\n\tfunction post(msg) {\n\t\tmsg[MARKER] = true;\n\t\ttry {\n\t\t\twindow.parent.postMessage(msg, '*');\n\t\t} catch (e) { /* parent gone — nothing to do */ }\n\t}\n\n\tfunction call(method, args) {\n\t\treturn new Promise(function (resolve, reject) {\n\t\t\tvar id = callSeq++;\n\t\t\tpending[id] = { resolve: resolve, reject: reject };\n\t\t\tpost({ kind: 'call', id: id, method: method, args: args });\n\t\t});\n\t}\n\n\t// ---- the public API ----------------------------------------------------\n\tvar spline = {\n\t\t/** Resolves once the editor has acknowledged the frame. */\n\t\tready: readyPromise,\n\t\tsetVariable: function (name, value) { return call('setVariable', [name, value]); },\n\t\tsetVariables: function (variables) { return call('setVariables', [variables]); },\n\t\tgetVariable: function (name) { return call('getVariable', [name]); },\n\t\tgetVariables: function () { return call('getVariables', []); },\n\t\tgetAllObjects: function () { return call('getAllObjects', []); },\n\t\tfindObjectByName: function (name) { return call('findObjectByName', [name]); },\n\t\tfindObjectById: function (id) { return call('findObjectById', [id]); },\n\t\t/** Read a mesh's live geometry ({vertexCount, triangleCount, indexed, bounds, vertices: Float32Array, indices?, normals?, uvs?}); options {space: 'local'|'world'}. Resolves undefined (with a console warning) when unreadable. */\n\t\tgetGeometry: function (nameOrId, options) { return call('getGeometry', [nameOrId, options || {}]); },\n\t\t/** Runtime-only transform/visibility update ({position,rotation,scale,visible}; rotation in degrees). */\n\t\tupdateObject: function (nameOrId, props) { return call('updateObject', [nameOrId, props]); },\n\t\t/** Runtime-only object creation ('Cube', 'Sphere', …, 'Text', 'Group', lights); resolves to the new object's snapshot. */\n\t\tcreateObject: function (type, options) {\n\t\t\t// A three.js material instance or createCustomMaterial factory can't cross\n\t\t\t// the postMessage boundary (textures/callbacks/functions fail\n\t\t\t// structured clone) — fail loud, not with a cryptic DataCloneError.\n\t\t\tif (options && options.material && (\n\t\t\t\toptions.material.isMaterial === true ||\n\t\t\t\ttypeof options.material === 'function'\n\t\t\t)) {\n\t\t\t\treturn Promise.reject(new Error(\n\t\t\t\t\t'createObject: custom three.js materials need the inline ' +\n\t\t\t\t\t'HTML-content mode (the editor Preview/Play frame and web ' +\n\t\t\t\t\t'exports); this embed runs the sandboxed mode, whose transport ' +\n\t\t\t\t\t'cannot carry them. Use a color/PBR bag or shared material ' +\n\t\t\t\t\t'name here instead.'\n\t\t\t\t));\n\t\t\t}\n\t\t\treturn call('createObject', [type, options || {}]);\n\t\t},\n\t\t/** Custom three.js/TSL materials — inline HTML-content mode only; the\n\t\t * factory function cannot cross this sandboxed transport. */\n\t\tcreateCustomMaterial: function () {\n\t\t\treturn Promise.reject(new Error(\n\t\t\t\t'createCustomMaterial: custom three.js materials need the inline ' +\n\t\t\t\t'HTML-content mode (the editor Preview/Play frame and web ' +\n\t\t\t\t'exports); this embed runs the sandboxed mode, whose transport ' +\n\t\t\t\t'cannot carry the factory function or the material it returns.'\n\t\t\t));\n\t\t},\n\t\t/** The live three texture an object samples — inline HTML-content mode\n\t\t * only; a Texture instance cannot cross this sandboxed transport. */\n\t\tgetTexture: function () {\n\t\t\treturn Promise.reject(new Error(\n\t\t\t\t'getTexture: a three.js texture instance needs the inline ' +\n\t\t\t\t'HTML-content mode (the editor Preview/Play frame and web ' +\n\t\t\t\t'exports); this embed runs the sandboxed mode, whose transport ' +\n\t\t\t\t'cannot carry it.'\n\t\t\t));\n\t\t},\n\t\t/** Replace a mesh's material with a custom three.js material — inline\n\t\t * HTML-content mode only; neither factories nor instances can cross\n\t\t * this sandboxed transport. */\n\t\tsetMaterial: function () {\n\t\t\treturn Promise.reject(new Error(\n\t\t\t\t'setMaterial: custom three.js materials need the inline ' +\n\t\t\t\t'HTML-content mode (the editor Preview/Play frame and web ' +\n\t\t\t\t'exports); this embed runs the sandboxed mode, whose transport ' +\n\t\t\t\t'cannot carry the factory function or the material it returns.'\n\t\t\t));\n\t\t},\n\t\t/** Runtime-only deep clone of an existing object; resolves to the clone's snapshot. */\n\t\tcloneObject: function (nameOrId, options) { return call('cloneObject', [nameOrId, options || {}]); },\n\t\t/** Removes an object (and its subtree); resolves to false when none matched. */\n\t\tremoveObject: function (nameOrId) { return call('removeObject', [nameOrId]); },\n\t\t/** Spawn a runtime-only copy of a template object; resolves to its snapshot ({id,...}) or undefined. */\n\t\tspawnObject: function (templateNameOrId, options) { return call('spawnObject', [templateNameOrId, options || {}]); },\n\t\t/** Remove a spawned copy by id (or assigned name). Spawned objects only. */\n\t\tdestroyObject: function (idOrName) { return call('destroyObject', [idOrName]); },\n\t\t/** Per-copy transform writes on a cloner ([{position,rotation,scale}|null, ...]; degrees); null clears all. Resolves to the copy count. */\n\t\tsetInstanceTransforms: function (nameOrId, transforms) { return call('setInstanceTransforms', [nameOrId, transforms === undefined ? null : transforms]); },\n\t\t/** An imported model's animation clips ([{id, name, duration, object: {id, name}}]) — one object's, or the whole scene's when omitted. */\n\t\tgetAnimations: function (nameOrId) { return call('getAnimations', [nameOrId]); },\n\t\t/** Play an imported clip by name or id (the object's first when omitted); options {loop: true|false|count, pingpong, fade: seconds, speed}. Resolves to the clip, or undefined. */\n\t\tplayAnimation: function (nameOrId, clip, options) { return call('playAnimation', [nameOrId, clip, options]); },\n\t\t/** Hold an object's clips (or one) where they are — every animated object when omitted; playAnimation resumes. */\n\t\tpauseAnimation: function (nameOrId, clip) { return call('pauseAnimation', [nameOrId, clip]); },\n\t\t/** Stop an object's clips (or one) on their first frame — every animated object when omitted. */\n\t\tstopAnimation: function (nameOrId, clip) { return call('stopAnimation', [nameOrId, clip]); },\n\t\t/** Trigger a Spline event on an object (requires Play mode). */\n\t\temitEvent: function (eventName, nameOrUuid) { return call('emitEvent', [eventName, nameOrUuid]); },\n\t\temitEventReverse: function (eventName, nameOrUuid) { return call('emitEventReverse', [eventName, nameOrUuid]); },\n\t\trequestRender: function () { return call('requestRender', []); },\n\t\taddEventListener: function (eventName, cb) {\n\t\t\tif (typeof cb !== 'function') return;\n\t\t\tif (!listeners[eventName]) {\n\t\t\t\tlisteners[eventName] = [];\n\t\t\t\tcall('listenEvent', [eventName]);\n\t\t\t}\n\t\t\tlisteners[eventName].push(cb);\n\t\t},\n\t\tremoveEventListener: function (eventName, cb) {\n\t\t\tvar list = listeners[eventName];\n\t\t\tif (!list) return;\n\t\t\tvar i = list.indexOf(cb);\n\t\t\tif (i !== -1) list.splice(i, 1);\n\t\t\tif (list.length === 0) {\n\t\t\t\tdelete listeners[eventName];\n\t\t\t\tcall('unlistenEvent', [eventName]);\n\t\t\t}\n\t\t},\n\t};\n\twindow.spline = spline;\n\n\t// ---- editor -> frame ---------------------------------------------------\n\twindow.addEventListener('message', function (event) {\n\t\tif (event.source !== window.parent) return;\n\t\tvar data = event.data;\n\t\tif (!data || data[MARKER] !== true) return;\n\t\tif (data.kind === 'ready-ack') {\n\t\t\tacked = true;\n\t\t\treadyResolve();\n\t\t} else if (data.kind === 'result') {\n\t\t\tvar entry = pending[data.id];\n\t\t\tif (!entry) return;\n\t\t\tdelete pending[data.id];\n\t\t\tif (data.ok) entry.resolve(data.value);\n\t\t\telse entry.reject(new Error(data.error || 'spline bridge call failed'));\n\t\t} else if (data.kind === 'event') {\n\t\t\tvar list = listeners[data.eventName];\n\t\t\tif (!list) return;\n\t\t\tfor (var i = 0; i < list.length; i++) {\n\t\t\t\ttry {\n\t\t\t\t\tlist[i](data.payload);\n\t\t\t\t} catch (e) {\n\t\t\t\t\treportError(e);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\t// ---- console + error capture --------------------------------------------\n\tfunction stringify(value, depth) {\n\t\ttry {\n\t\t\tif (typeof value === 'string') return value;\n\t\t\tif (value instanceof Error) return value.stack || String(value);\n\t\t\tif (typeof value === 'function') return '[function ' + (value.name || 'anonymous') + ']';\n\t\t\tif (value === undefined) return 'undefined';\n\t\t\tvar seen = [];\n\t\t\tvar json = JSON.stringify(value, function (k, v) {\n\t\t\t\tif (typeof v === 'object' && v !== null) {\n\t\t\t\t\tif (seen.indexOf(v) !== -1) return '[circular]';\n\t\t\t\t\tseen.push(v);\n\t\t\t\t}\n\t\t\t\tif (typeof v === 'function') return '[function]';\n\t\t\t\treturn v;\n\t\t\t});\n\t\t\treturn json === undefined ? String(value) : json;\n\t\t} catch (e) {\n\t\t\ttry { return String(value); } catch (e2) { return '[unserializable]'; }\n\t\t}\n\t}\n\n\tfunction sendConsole(level, args) {\n\t\tvar parts = [];\n\t\tfor (var i = 0; i < args.length; i++) parts.push(stringify(args[i]));\n\t\tvar text = parts.join(' ');\n\t\tif (text.length > 4000) text = text.slice(0, 4000) + '…';\n\t\tpost({ kind: 'console', level: level, text: text });\n\t}\n\n\t['log', 'info', 'warn', 'error'].forEach(function (level) {\n\t\tvar original = console[level];\n\t\tconsole[level] = function () {\n\t\t\tsendConsole(level, arguments);\n\t\t\tif (original) original.apply(console, arguments);\n\t\t};\n\t});\n\n\tfunction reportError(error) {\n\t\tsendConsole('error', [error instanceof Error ? error : String(error)]);\n\t}\n\twindow.addEventListener('error', function (event) {\n\t\tsendConsole('error', [event.message + (event.filename ? ' (' + event.filename + ':' + event.lineno + ')' : '')]);\n\t});\n\twindow.addEventListener('unhandledrejection', function (event) {\n\t\tsendConsole('error', ['Unhandled promise rejection: ' + stringify(event.reason)]);\n\t});\n\n\t// ---- input passthrough ---------------------------------------------------\n\t// A pointer that goes DOWN on the page background belongs to the 3D scene\n\t// until it is released; one that goes down on generated UI never forwards.\n\tvar forwardedPointers = {};\n\n\t// Touch: this frame covers the whole canvas, so on a phone every finger\n\t// lands in this document — where the host's \`touch-action: none\` on the\n\t// canvas can't reach. Left at the default, the browser claims the gesture\n\t// for itself: a one-finger drag scrolls the host page (and cancels the\n\t// forwarded pointer, so the orbit never starts) and a pinch zooms the\n\t// whole page instead of the camera. The scene owns gestures on the\n\t// background; a scrolling panel in the generated UI still scrolls (a\n\t// scroll container starts its own touch-action chain), and taps still\n\t// click. Not !important, so a document that wants page panning can say so.\n\tvar touchStyle = document.createElement('style');\n\ttouchStyle.textContent = 'html,body{touch-action:none}';\n\t(document.head || document.documentElement).appendChild(touchStyle);\n\t// Older iOS Safari pinch-zooms past touch-action; its gesture events are\n\t// the only way to stop that.\n\t['gesturestart', 'gesturechange'].forEach(function (type) {\n\t\tdocument.addEventListener(type, function (e) {\n\t\t\te.preventDefault();\n\t\t});\n\t});\n\n\tfunction isBackground(target) {\n\t\tif (!target || target === document || target === document.documentElement || target === document.body) {\n\t\t\treturn true;\n\t\t}\n\t\tif (target.closest && target.closest('[data-spline-passthrough]')) return true;\n\t\treturn false;\n\t}\n\n\tfunction baseInput(e, type) {\n\t\treturn {\n\t\t\ttype: type,\n\t\t\tx: e.clientX,\n\t\t\ty: e.clientY,\n\t\t\tbutton: e.button,\n\t\t\tbuttons: e.buttons,\n\t\t\tpointerId: e.pointerId,\n\t\t\tpointerType: e.pointerType,\n\t\t\tisPrimary: e.isPrimary,\n\t\t\tmovementX: e.movementX,\n\t\t\tmovementY: e.movementY,\n\t\t\tshiftKey: e.shiftKey,\n\t\t\tctrlKey: e.ctrlKey,\n\t\t\taltKey: e.altKey,\n\t\t\tmetaKey: e.metaKey,\n\t\t};\n\t}\n\n\tdocument.addEventListener('pointerdown', function (e) {\n\t\tif (!isBackground(e.target)) return;\n\t\tforwardedPointers[e.pointerId] = true;\n\t\tpost({ kind: 'input', event: baseInput(e, 'pointerdown') });\n\t}, true);\n\n\tdocument.addEventListener('pointermove', function (e) {\n\t\tif (!forwardedPointers[e.pointerId] && !isBackground(e.target)) return;\n\t\tpost({ kind: 'input', event: baseInput(e, 'pointermove') });\n\t}, true);\n\n\t['pointerup', 'pointercancel'].forEach(function (type) {\n\t\tdocument.addEventListener(type, function (e) {\n\t\t\tvar wasForwarded = forwardedPointers[e.pointerId];\n\t\t\tdelete forwardedPointers[e.pointerId];\n\t\t\tif (!wasForwarded && !isBackground(e.target)) return;\n\t\t\tpost({ kind: 'input', event: baseInput(e, type) });\n\t\t}, true);\n\t});\n\n\t['click', 'dblclick'].forEach(function (type) {\n\t\tdocument.addEventListener(type, function (e) {\n\t\t\tif (!isBackground(e.target)) return;\n\t\t\tpost({ kind: 'input', event: baseInput(e, type) });\n\t\t}, true);\n\t});\n\n\t// A right-drag on the background pans the scene; without this the browser\n\t// also opens its context menu, which the canvas's own controls suppress.\n\tdocument.addEventListener('contextmenu', function (e) {\n\t\tif (isBackground(e.target)) e.preventDefault();\n\t}, true);\n\n\tdocument.addEventListener('wheel', function (e) {\n\t\tif (!isBackground(e.target)) return;\n\t\te.preventDefault();\n\t\tvar msg = baseInput(e, 'wheel');\n\t\tmsg.deltaX = e.deltaX;\n\t\tmsg.deltaY = e.deltaY;\n\t\tmsg.deltaMode = e.deltaMode;\n\t\t// The legacy wheelDelta fields carry the trackpad-vs-mouse signature\n\t\t// the editor's pan/zoom discrimination reads (wheelDeltaY === -3*dY\n\t\t// on trackpads) — a reconstructed WheelEvent loses them, turning\n\t\t// two-finger pans into zooms. Forward them verbatim.\n\t\tif (typeof e.wheelDeltaX === 'number') msg.wheelDeltaX = e.wheelDeltaX;\n\t\tif (typeof e.wheelDeltaY === 'number') msg.wheelDeltaY = e.wheelDeltaY;\n\t\tpost({ kind: 'input', event: msg });\n\t}, { capture: true, passive: false });\n\n\t['keydown', 'keyup'].forEach(function (type) {\n\t\tdocument.addEventListener(type, function (e) {\n\t\t\t// Never steal keys from the page's own form fields.\n\t\t\tvar t = e.target;\n\t\t\tif (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;\n\t\t\tpost({ kind: 'input', event: {\n\t\t\t\ttype: type,\n\t\t\t\tkey: e.key,\n\t\t\t\tcode: e.code,\n\t\t\t\trepeat: e.repeat,\n\t\t\t\tshiftKey: e.shiftKey,\n\t\t\t\tctrlKey: e.ctrlKey,\n\t\t\t\taltKey: e.altKey,\n\t\t\t\tmetaKey: e.metaKey,\n\t\t\t} });\n\t\t}, true);\n\t});\n\n\t// ---- handshake -----------------------------------------------------------\n\t// Announce readiness and KEEP announcing until the editor acks. A single\n\t// 'ready' can race the editor attaching its listener (or land while the\n\t// editor is busy); code that awaits spline.ready would then hang forever.\n\t// The editor acks every 'ready' (and posts a proactive ack on attach), so\n\t// this settles within one round-trip in the normal case.\n\tpost({ kind: 'ready' });\n\tvar readyRetry = setInterval(function () {\n\t\tif (acked) {\n\t\t\tclearInterval(readyRetry);\n\t\t\treturn;\n\t\t}\n\t\tpost({ kind: 'ready' });\n\t}, 250);\n})();`;function Wt(e){return null==e||""===e?void 0:String(e)}var Ht=class{constructor(e,t,n){this.deps=e,this.onConsole=t,this.onEvent=n,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let e of this.eventUnsubs.values())e();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(e,t){let n=this.deps;switch(e){case"setVariable":{let e=n.setVariable(String(t[0]),t[1]);return e.warning&&this.onConsole("warn",e.warning),e.ok}case"setVariables":{let e=t[0]??{},r=!0;for(let[t,i]of Object.entries(e)){let e=n.setVariable(t,i);e.warning&&this.onConsole("warn",e.warning),r=r&&e.ok}return r}case"getVariable":return n.getVariable(String(t[0]));case"getVariables":return n.getVariables();case"getAllObjects":return n.getAllObjects();case"findObjectByName":case"findObjectById":return n.findObject(String(t[0]));case"getGeometry":{let e=n.getGeometry(String(t[0]),t[1]??{});return e.warning&&this.onConsole("warn",e.warning),e.data}case"updateObject":return n.updateObject(String(t[0]),t[1]??{});case"createObject":return n.createObject(String(t[0]),t[1]??{});case"createCustomMaterial":if(void 0===n.createCustomMaterial)throw new Error("createCustomMaterial: not available on this surface — custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.createCustomMaterial(t[0]);case"getTexture":if(void 0===n.getTexture)throw new Error("getTexture: not available on this surface — a three.js texture instance needs the inline HTML-content mode (editor Preview/Play and web exports).");return n.getTexture(String(t[0]),t[1]??{});case"setMaterial":if(void 0===n.setMaterial)throw new Error("setMaterial: not available on this surface — custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.setMaterial(String(t[0]),t[1]);case"cloneObject":return n.cloneObject(String(t[0]),t[1]??{});case"removeObject":return n.removeObject(String(t[0]));case"spawnObject":{let e=n.spawnObject(String(t[0]),t[1]??{});return e.warning&&this.onConsole("warn",e.warning),e.object}case"destroyObject":return n.destroyObject(String(t[0]));case"setInstanceTransforms":{let e=null===t[1]||void 0===t[1]?null:t[1],r=n.setInstanceTransforms(String(t[0]),e);return r<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(t[0])}" has no cloner — make the object a cloner first (its copies are what this drives).`),r}case"getAnimations":{let r=n.getAnimations(Wt(t[0]));return r.warning&&this.onConsole("warn",`spline.${e}: ${r.warning}`),r.clips}case"playAnimation":{let r="object"==typeof t[1]&&null!==t[1],i=n.playAnimation(String(t[0]),r?void 0:Wt(t[1]),(r?t[1]:t[2])??{});return i.warning&&this.onConsole("warn",`spline.${e}: ${i.warning}`),i.clip}case"pauseAnimation":case"stopAnimation":{let r=Wt(t[0]),i=Wt(t[1]),s="pauseAnimation"===e?n.pauseAnimation(r,i):n.stopAnimation(r,i);return s.warning&&this.onConsole("warn",`spline.${e}: ${s.warning}`),s.ok}case"emitEvent":case"emitEventReverse":{let r=n.emitEvent(String(t[0]),String(t[1]),"emitEventReverse"===e);return r.warning&&this.onConsole("warn",r.warning),r.ok}case"requestRender":return n.requestRender(),!0;case"listenEvent":{let e=String(t[0]);return"variableChange"===e?this.startVariablePolling():this.eventUnsubs.has(e)||this.eventUnsubs.set(e,n.addSplineEventListener(e,t=>{this.onEvent(e,t)})),!0}case"unlistenEvent":{let e=String(t[0]);return"variableChange"===e?this.stopVariablePolling():(this.eventUnsubs.get(e)?.(),this.eventUnsubs.delete(e)),!0}default:throw new Error(`Unknown spline bridge method: ${e}`)}}startVariablePolling(){null===this.variablePollHandle&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let e=this.deps.getVariables(),t=function(e,t){let n=[];for(let r of Object.keys(t))e[r]!==t[r]&&n.push({name:r,value:t[r]});return n}(this.lastVariables??{},e);this.lastVariables=e;for(let e of t)this.onEvent("variableChange",e)},100))}stopVariablePolling(){null!==this.variablePollHandle&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}};function Ft(e,t,n,r){return[e[0]*t+e[4]*n+e[8]*r+e[12],e[1]*t+e[5]*n+e[9]*r+e[13],e[2]*t+e[6]*n+e[10]*r+e[14]]}var $t=class{constructor(e,t,n){this.iframe=e,this.deps=t,this.onConsole=n,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=e=>{if(this.disposed||e.source!==this.iframe.contentWindow)return;let t=e.data;var n;"object"!=typeof(n=t)||null===n||!0!==n[Nt]||"string"!=typeof n.kind||this.handleMessage(t)},this.host=new Ht(t,n,(e,t)=>{this.sendEvent(e,t)})}attach(){window.addEventListener("message",this.onMessage),this.send({[Nt]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) — if the page looks frozen, check for errors in its code.")},6e3)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),null!==this.handshakeTimer&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(e){switch(e.kind){case"ready":this.handshakeSeen=!0,this.send({[Nt]:!0,kind:"ready-ack"});break;case"console":this.onConsole(e.level,e.text);break;case"call":{let t;try{t=Promise.resolve(this.host.execute(e.method,e.args))}catch(e){t=Promise.reject(e)}t.then(t=>{this.send({[Nt]:!0,kind:"result",id:e.id,ok:!0,value:t,error:void 0})},t=>{let n=t instanceof Error?t.message:String(t);this.send({[Nt]:!0,kind:"result",id:e.id,ok:!1,value:void 0,error:n}),this.onConsole("error",n)});break}case"input":this.dispatchInput(e.event)}}send(e){this.iframe.contentWindow?.postMessage(e,"*")}sendEvent(e,t){this.send({[Nt]:!0,kind:"event",eventName:e,payload:t})}dispatchInput(e){let t=this.deps.getCanvas();if(!t)return;let n=this.iframe.getBoundingClientRect(),r={bubbles:!0,cancelable:!0,view:window,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey};switch(e.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":t.dispatchEvent(new PointerEvent(e.type,{...r,clientX:(e.x??0)+n.left,clientY:(e.y??0)+n.top,button:e.button,buttons:e.buttons,pointerId:e.pointerId,pointerType:e.pointerType,isPrimary:e.isPrimary,movementX:e.movementX,movementY:e.movementY}));break;case"click":case"dblclick":t.dispatchEvent(new MouseEvent(e.type,{...r,clientX:(e.x??0)+n.left,clientY:(e.y??0)+n.top,button:e.button,buttons:e.buttons}));break;case"wheel":{let i=new WheelEvent("wheel",{...r,clientX:(e.x??0)+n.left,clientY:(e.y??0)+n.top,deltaX:e.deltaX,deltaY:e.deltaY,deltaMode:e.deltaMode});"number"==typeof e.wheelDeltaX&&Object.defineProperty(i,"wheelDeltaX",{value:e.wheelDeltaX}),"number"==typeof e.wheelDeltaY&&Object.defineProperty(i,"wheelDeltaY",{value:e.wheelDeltaY}),t.dispatchEvent(i);break}case"keydown":case"keyup":t.dispatchEvent(new KeyboardEvent(e.type,{...r,key:e.key,code:e.code,repeat:e.repeat}))}}};function qt(e){let t=e.points.length/7,n=new Re;for(let r=0;r<t;r++){let t=7*r,i=e.points[t+0],s=e.points[t+1],a=e.points[t+2],o=e.points[t+3],l=e.points[t+4],c=e.points[t+5],h=e.points[t+6];n.push({fi:r,id:Fe.generateUUID(),data:{roundness:h,position:[i,s],areControlsDirectionsMirrored:!0,controlPrevious:{position:[a,o]},controlNext:{position:[l,c]}}})}return{points:n,isClosed:e.isClosed,roundness:e.roundness,shapeHoles:e.shapeHoles?.map(e=>qt(e))??[]}}function Yt(e){let{userData:t,uuid:n,...r}=e;if(void 0===t||"NonParametricGeometry"===t.type)return function(e){let t,{userData:n,data:r}=e,i=r?.groups,s=r?.attributes??{},a=r?.morphAttributes??{},o=r?.interleavedBuffers,l=r?.arrayBuffers,c=r?.index;void 0!==s.position&&Array.isArray(s.position.array)&&(t=function(e){let t=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,a=-1/0;for(let o=0;o<e.length;o+=3){let l=e[o],c=e[o+1],h=e[o+2];t=Math.min(t,l),n=Math.min(n,c),r=Math.min(r,h),i=Math.max(i,l),s=Math.max(s,c),a=Math.max(a,h)}return{width:i-t,height:s-n,depth:a-r}}(s.position.array));let h={...void 0===n?{}:n.parameters,data:{attributes:s,morphAttributes:a,interleavedBuffers:o,arrayBuffers:l},...void 0===t?{}:t,type:"NonParametricGeometry"};return void 0!==c&&Object.assign(h.data,{index:c}),void 0!==i&&Object.assign(h.data,{groups:i.map(e=>({...e,materialIndex:e.materialIndex??0}))}),h}(e);if("SubdivGeometry"===t.type){let e="SubdivGeometry",n=r.data?.attributes;if(void 0===n?.positionWASM){let e=new nt;if(void 0===n?.position||void 0===n?.faceMap)return null;let t=n.position.array,i=n.faceMap.array,s=r.data.index.array;e.setAttribute("position",new tt(t,3)),e.setIndex(new et(s,1));let a=G(e),o=[],l=new Array(i[i.length-1]+1).fill(3),c=a.getIndex().array;for(let e=0,t=i.length;e<t;)i[e]===i[e+1]?(l[i[e]]++,o.push(...new Set(c.slice(3*e,3*e+6))),e+=2):(o.push(...c.slice(3*e,3*e+3)),e++);n.indexWASM={array:o},n.positionWASM=a.attributes.position,n.verticesPerFaceWASM={array:l}}if(void 0===n?.positionWASM||0===n?.positionWASM.length||void 0===n?.indexWASM||0===n?.indexWASM.length||void 0===n?.verticesPerFaceWASM||0===n?.verticesPerFaceWASM.length)return null;let i={type:e,...Jt(n.positionWASM.array)};i.subdivisions=t.parameters.subdivisions;for(let e in n)"positionWASM"===e?i[e]=new Float32Array(n[e].array):"indexWASM"===e?i[e]=new Int32Array(n[e].array):"verticesPerFaceWASM"===e&&(i[e]=new Int8Array(n[e].array));return i.scaleBaked=[1,1,1],i}let i=t.type,s=t.parameters;return"VectorGeometry"===i?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:qt(t.shape),type:i}):"LatheGeometry"===i?{...t.parameters,type:i,points:(t?.parameters.points??[]).map(e=>[e.x,e.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:i})}new Xe,new qe,new Ze,new Ye,new Ye;var Xt=new Qe,Zt=new Ye;function Jt(e){return Xt.setFromArray(e),Xt.getSize(Zt),{width:Zt.x,height:Zt.y,depth:Zt.z}}var Qt=class{constructor(e,t,n,r,i,s){if(this.id=e,this.data=t,this.object=n,this.entered=!1,("KeyDown"===t.type||"KeyUp"===t.type||"KeyPress"===t.type)&&!t.key)throw new Error("Missing property");this.actions=Q(t,t.actions,r,i,s,n)}disconnect(){ee(this.actions)}dispatchHeld(e){this.actions.Create.forEach(t=>{e&&t.dispatchThrottled.cancel(),t.dispatchThrottled()})}dispatch(e=!1){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),"MousePress"===this.data.type||"KeyPress"===this.data.type?this.entered||(this.entered=!0,this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStart())):(this.actions.Transition.some(e=>e.playing&&"Toggle"!==e.data.runMode)||this.actions.Transition.forEach(e=>e.play()),this.actions.SwitchCamera.some(e=>e.playing&&"Toggle"!==e.data.runMode)||this.actions.SwitchCamera.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.Animation.forEach(e=>{"runMode"in e.data&&"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&"Toggle"===e.data.runMode?e.toggle():e.play()})),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),!1===e&&this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}dispatchRelease(){this.entered&&(this.entered=!1,this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Particles.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStop()))}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent())),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}},en=class extends v{constructor(e,t,n){super(e),this.eventManager=t,this.useForRaycastProperty=n,this.objectsPerTypes={MouseDown:[],MouseUp:[],MousePress:[],KeyDown:[],KeyUp:[],KeyPress:[]},this.canvasMouseEvents=[],this.eventsPerObjects={MouseDown:{},MouseUp:{},MousePress:{},KeyDown:{},KeyUp:{},KeyPress:{}},this.heldKeys={},this.heldKeysPress={},this._prevObjects=[],this.sceneInterects=null,this.onCanvasRaycast=e=>{if(!0===this.useForRaycastProperty&&null===this.sceneInterects){this.eventContext.updateRaycaster(e);let{raycaster:t,page:n}=this.eventContext,r=l(t,n,[],!0);this.sceneInterects=r,r.length&&(this.eventContext.sharedAssets.raycastProperty={x:r[0].point.x,y:r[0].point.y,z:r[0].point.z,objX:r[0].object.matrixWorld.elements[12],objY:r[0].object.matrixWorld.elements[13],objZ:r[0].object.matrixWorld.elements[14]})}},this.onCanvasMouseDown=e=>{(e.target===this.eventContext.domElement||"SPLINE-VIEWER"===e.target.tagName)&&this.canvasMouseEvents.forEach(t=>{("MouseDown"===t.data.type||"MousePress"===t.data.type)&&(this.onCanvasRaycast(e),t.dispatch())})},this.onCanvasMouseUp=e=>{(e.target===this.eventContext.domElement||"SPLINE-VIEWER"===e.target.tagName)&&this.canvasMouseEvents.forEach(t=>{"MouseUp"===t.data.type?(this.onCanvasRaycast(e),t.dispatch()):"MousePress"===t.data.type&&t.dispatchRelease()})},this.onMouseDown=e=>{C.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseEvent("MouseDown"))},this.onMouseUp=e=>{C.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseEvent("MouseUp"))},this.onMousePressDown=e=>{C.length>1||(this.eventContext.updateRaycaster(e),this.handleMousePressEvent())},this.onMousePressRelease=e=>{C.length>1||(this.eventContext.updateRaycaster(e),this.handleMousePressEvent(!0))},this.onKeyDown=e=>{this.heldKeys[e.key]||(this.handleKeyEvent(e,"KeyDown"),this.handleKeyEventHeld(e,"KeyDown",!0)),this.heldKeys[e.key]=!0},this.onKeyUp=e=>{this.handleKeyEvent(e,"KeyUp"),this.handleKeyEventHeld(e,"KeyUp",!0)},this.onKeyPressDown=e=>{this.heldKeysPress[e.key]?this.handleKeyEventHeld(e,"KeyPress"):(this.handleKeyEvent(e,"KeyPress"),this.handleKeyEventHeld(e,"KeyPress",!0)),this.heldKeysPress[e.key]=!0},this.onKeyPressUp=e=>{this.handleKeyEvent(e,"KeyPress",!0)},this.releaseHeldKey=e=>{delete this.heldKeys[e.key]},this.releaseHeldKeyPress=e=>{delete this.heldKeysPress[e.key]},this._onUserEvent=({eventName:e,target:t,reverse:n})=>{if(!e||!t)return;let r=m(e);r&&("MouseDown"===r||"MouseUp"===r||"MousePress"===r?(t.dispatchEvent({type:"beginEvent",eventName:r}),this.eventsPerObjects[r]?.[t.uuid]?.forEach(e=>{e.dispatchUserEvent(n)}),this.canvasMouseEvents.forEach(e=>{e.dispatchUserEvent(n)})):("KeyDown"===r||"KeyUp"===r||"KeyPress"===r)&&(t.dispatchEvent({type:"beginEvent",eventName:r}),this.eventsPerObjects[r]?.[t.uuid]?.forEach(e=>{e.dispatchUserEvent()})))}}connect(){let{page:e,sharedAssets:t,domElement:n}=this.eventContext,r=(n,r)=>{if(!n.data?.events.length)return;let i=["MouseDown","MouseUp","MousePress","KeyDown","KeyUp","KeyPress"];for(let s of i){let i=this.eventsPerObjects[s];if(n.data.events.filter(({data:e})=>e.type===s&&!0!==e.disabled).forEach(({id:r,data:s})=>{try{let a=new Qt(r,s,n,e,t,this.eventManager);a.actions.Video.length&&(this.hasVideoAction=!0),"MouseDown"!==s.type&&"MouseUp"!==s.type&&"MousePress"!==s.type||"Canvas"!==s.mode&&"Window"!==s.mode?(i[n.uuid]?i[n.uuid].some(e=>e.id===a.id)||i[n.uuid].push(a):i[n.uuid]=[a],se(n)&&n.traverseChildren(e=>{if(!e.visible)return!0;e instanceof H&&"shapeBlendNode"in e.data.geometry&&2!==e.data.geometry.shapeBlendNode?.operation&&(i[e.uuid]?i[e.uuid].push(a):i[e.uuid]=[a])})):this.canvasMouseEvents.push(a)}catch(e){}}),i[n.uuid]?.length&&(this.objectsPerTypes[s].push(!ae(n)||"MouseDown"!==s&&"MouseUp"!==s&&"MousePress"!==s?n:r),se(n))){let e=this.objectsPerTypes[s];n.traverseChildren(t=>{if(!t.visible)return!0;t instanceof H&&-1===e.indexOf(t)&&e.push(t)})}}};e.traverseEntity(e=>{(oe(e)||e instanceof x)&&e.frame?.traverse(t=>{r(t,e)}),r(e)}),this.heldKeys={},this.heldKeysPress={},this.domEventsNeeded.clear(),n.addEventListener("pointerdown",this.onCanvasMouseDown),n.addEventListener("pointerup",this.onCanvasMouseUp),(this.objectsPerTypes.MouseDown?.length||this.useForRaycastProperty)&&(this.domEventsNeeded.add("pointerdown"),n.addEventListener("pointerdown",this.onMouseDown)),this.objectsPerTypes.MouseUp?.length&&(this.domEventsNeeded.add("pointerup"),n.addEventListener("pointerup",this.onMouseUp)),this.objectsPerTypes.MousePress?.length&&(this.domEventsNeeded.add("pointerdown"),n.addEventListener("pointerdown",this.onMousePressDown),this.domEventsNeeded.add("pointerup"),n.addEventListener("pointerup",this.onMousePressRelease)),this.objectsPerTypes.KeyDown?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.releaseHeldKey)),this.objectsPerTypes.KeyUp?.length&&(this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyUp)),this.objectsPerTypes.KeyPress?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyPressDown),document.addEventListener("keyup",this.releaseHeldKeyPress),this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyPressUp)),Object.entries(this.objectsPerTypes).forEach(([e,t])=>{t.forEach(e=>{e.addEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(e=>{e.object.addEventListener("userEvent",this._onUserEvent)})}disconnect(){let{domElement:e}=this.eventContext;this.domEventsNeeded.clear(),this.heldKeys={},this.heldKeysPress={},e.removeEventListener("pointerdown",this.onCanvasMouseDown),e.removeEventListener("pointerup",this.onCanvasMouseUp),e.removeEventListener("pointerdown",this.onMouseDown),e.removeEventListener("pointerdown",this.onMousePressDown),e.removeEventListener("pointerup",this.onMouseUp),e.removeEventListener("pointerup",this.onMousePressRelease),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp),document.removeEventListener("keydown",this.onKeyPressDown),document.removeEventListener("keyup",this.onKeyPressUp),document.removeEventListener("keyup",this.releaseHeldKey),Object.values(this.eventsPerObjects).forEach(e=>{Object.values(e).forEach(e=>{e.forEach(e=>{e.disconnect()})})}),this.canvasMouseEvents.forEach(e=>{e.disconnect()}),Object.entries(this.objectsPerTypes).forEach(([e,t])=>{t.forEach(e=>{e.removeEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(e=>{e.object.removeEventListener("userEvent",this._onUserEvent)})}handleMouseEvent(e){let{stopRaycast:t,raycaster:n,page:r,pointerScreen:i}=this.eventContext,s=this.objectsPerTypes[e],a=s.filter(e=>!ae(e));if((s.length||this.useForRaycastProperty)&&(!r.uiCanvas||!h(r,[i.x,i.y],Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}))){if(t||this.useForRaycastProperty){let i;if(null===this.sceneInterects?i=l(n,r,a,this.useForRaycastProperty):(i=this.sceneInterects,this.sceneInterects=null),this.useForRaycastProperty&&i.length&&(this.eventContext.sharedAssets.raycastProperty={x:i[0].point.x,y:i[0].point.y,z:i[0].point.z,objX:i[0].object.matrixWorld.elements[12],objY:i[0].object.matrixWorld.elements[13],objZ:i[0].object.matrixWorld.elements[14]}),t){let t=[i[0]?.uv?.x??0,i[0]?.uv?.y??0];c(i).forEach(n=>{oe(n)&&h(n,t,Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}),this.eventsPerObjects[e][n.uuid]&&this.handleObjectMouseEventDispatch(n,e)})}}t||a.forEach(t=>{let r=d(n,t);r&&(this.handleObjectMouseEventDispatch(t,e),oe(t)&&h(t,[r?.uv?.x??0,r?.uv?.y??0],Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}))})}}handleMousePressEvent(e=!1){let t="MousePress",n=this.objectsPerTypes[t],r=n.filter(e=>!ae(e)),i=[];if(n.length){if(!e){let{stopRaycast:e,raycaster:n,page:s,pointerScreen:a}=this.eventContext,o=!1;if(s.uiCanvas&&(o=h(s,[a.x,a.y],Object.keys(this.eventsPerObjects[t]),e=>{i.push(e)})),e&&!o){let e=l(n,s,r);i=c(e),e.forEach(e=>{oe(e.object)&&h(e.object,[e?.uv?.x??0,e?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),e=>{i.push(e)})})}else r.forEach(e=>{let r=d(n,e);r&&(i.push(e),oe(e)&&h(e,[r?.uv?.x??0,r?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),e=>{i.push(e)}))})}this._prevObjects.length&&this._prevObjects.forEach(e=>{i.includes(e)||this.handleObjectMouseEventDispatchRelease(e,t)}),i.length&&i.forEach(e=>{this.handleObjectMouseEventDispatch(e,t)}),this._prevObjects=i}}handleObjectMouseEventDispatch(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(e=>{e.dispatch()})}handleObjectMouseEventDispatchRelease(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(e=>{e.dispatchRelease()})}handleKeyEvent(e,t,n=!1){this.objectsPerTypes[t].forEach(r=>{let i=this.eventsPerObjects[t][r.uuid];i.some(({data:t})=>"key"in t&&t.key===e.key)&&r.dispatchEvent({type:"beginEvent",eventName:t}),i.forEach(t=>{"key"in t.data&&t.data.key===e.key&&(n?t.dispatchRelease():t.dispatch(!0))})})}handleKeyEventHeld(e,t,n=!1){this.objectsPerTypes[t].forEach(r=>{this.eventsPerObjects[t][r.uuid].forEach(t=>{"key"in t.data&&t.data.key===e.key&&t.dispatchHeld(n)})})}},tn=e=>!0===e?.isPlayAudioAction,nn=e=>!0===e?.isPauseAudioAction,rn=e=>!0===e?.isPlayVideoAction,sn=e=>!0===e?.isPauseVideoAction,an=class{constructor(e,t,n,r,i,s){this.id=e,this.data=t,this.object=n,this.actions=Q(t,t.actions,r,i,s,n)}disconnect(){ee(this.actions)}dispatch(){this.actions.Transition.forEach(e=>{e.play()}),this.actions.Animation.forEach(e=>{e.play()}),this.actions.TimelineAnimation.forEach(e=>{e.play()}),this.actions.SwitchCamera.forEach(e=>{e.play()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()),this.actions.Create.forEach(e=>{e.dispatchFromStart()}),this.actions.Destroy.forEach(e=>{e.dispatchFromStart()})}dispatchAfter(e){this.actions.Audio.forEach(t=>{(t.interaction.data.triggerAfter??"any")===e&&(tn(t.interaction)?t.interaction.audioPlayer?.play():nn(t.interaction)&&t.interaction.dispatch())}),this.actions.Video.forEach(t=>{let n=t.interaction.data.triggerAfter??"autoplay";n===e&&(rn(t.interaction)?t.interaction.play("autoplay"===n):sn(t.interaction)&&t.interaction.dispatch())}),this.actions.Particles.forEach(t=>{(t.data.triggerAfter??"any")===e&&t.dispatchBasic()})}async seekVideos(e){let t=[];this.actions.Video.forEach(n=>{"autoplay"===(n.interaction.data.triggerAfter??"autoplay")&&rn(n.interaction)&&t.push(n.interaction.seek(e))}),await Promise.all(t)}pauseVideos(){this.actions.Video.forEach(e=>{rn(e.interaction)&&e.interaction.pause()})}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent())),this.actions.SceneTransition.forEach(e=>e.dispatch()),this.actions.Reset.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{tn(e.interaction)?e.interaction.audioPlayer?.play():nn(e.interaction)&&e.interaction.dispatch()}),this.actions.Video.forEach(e=>{rn(e.interaction)?e.interaction.play():sn(e.interaction)&&e.interaction.dispatch()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()})}},on=class extends v{constructor(e,t){super(e),this.eventManager=t,this.eventsPerObject=new Map,this.eventsAfterPerObject=new Map,this.onMouseDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("mouseDown")})})},this.onKeyDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("keyDown")})})},this.onAny=()=>{let{domElement:e,isExport:t}=this.eventContext,n=t?document:e;n.removeEventListener("pointerdown",this.onAny),n.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("any")})})},this.onSceneTransitionAudioVideoPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.actions.Audio.forEach(e=>{tn(e.interaction)&&e.interaction.audioPlayer?.play()}),e.actions.Video.forEach(e=>{let t=e.interaction.data.triggerAfter??"autoplay";rn(e.interaction)&&e.interaction.play("autoplay"===t)}),e.actions.Particles.forEach(e=>{e.dispatchBasic()})})})},this.onPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("autoplay")})})},this.seekVideos=async e=>{let t=[];[...this.eventsAfterPerObject.entries()].forEach(([n,r])=>{!n.data.visible||r.forEach(n=>{t.push(n.seekVideos(e))})}),await Promise.all(t)},this.pauseVideos=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{t.forEach(e=>{e.pauseVideos()})})},this.onUserEvent=({eventName:e,target:t,reverse:n})=>{if(!e||!t)return;let r=m(e);r&&"Start"===r&&(ae(t)||t.dispatchEvent({type:"beginEvent",eventName:"Start"}),this.eventsPerObject.get(t)?.forEach(e=>{e.dispatchUserEvent(n)}),this.eventsAfterPerObject.get(t)?.forEach(e=>{e.dispatchUserEvent(n)}))}}connect(){let{sharedAssets:e,page:t}=this.eventContext,n=n=>{if(n.data?.events.length)for(let{id:r,data:i}of n.data.events){if(i.disabled||"Start"!==i.type)continue;let s=new an(r,i,n,t,e,this.eventManager);(s.actions.Transition.length||s.actions.TimelineAnimation.length||s.actions.Animation.length||s.actions.SwitchCamera.length||s.actions.Create.length||s.actions.Destroy.length||s.actions.SceneTransition.length||s.actions.Reset.length||s.actions.SetVariable.length||s.actions.DynamicVariablePlay.length||s.actions.ClearLocalStorage.length||s.actions.UserAPI.length)&&(this.eventsPerObject.has(n)?this.eventsPerObject.get(n)?.push(s):this.eventsPerObject.set(n,[s])),s.actions.Audio.length&&(this.eventsAfterPerObject.has(n)?this.eventsAfterPerObject.get(n)?.push(s):this.eventsAfterPerObject.set(n,[s])),s.actions.Video.length&&(this.hasVideoAction=!0,this.eventsAfterPerObject.has(n)?this.eventsAfterPerObject.get(n)?.push(s):this.eventsAfterPerObject.set(n,[s])),s.actions.Particles.length&&(this.eventsAfterPerObject.has(n)?this.eventsAfterPerObject.get(n)?.push(s):this.eventsAfterPerObject.set(n,[s]))}};if(t.traverseEntity(e=>{(oe(e)||e instanceof x)&&e.frame?.traverse(e=>{n(e)}),n(e)}),[...this.eventsAfterPerObject.values()].some(e=>e.length)){if(0===this.eventManager.activateCount){let{domElement:e,isExport:t}=this.eventContext,n=t?document:e;n.addEventListener("pointerdown",this.onMouseDown,{once:!0}),n.addEventListener("mousedown",this.onMouseDown,{once:!0}),document.addEventListener("keydown",this.onKeyDown,{once:!0}),n.addEventListener("pointerdown",this.onAny),n.addEventListener("mousedown",this.onAny),document.addEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.addEventListener("userEvent",this.onUserEvent)})}else this.onSceneTransitionAudioVideoPlay();this.onPlay()}[...this.eventsPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>e.dispatch()),e.addEventListener("userEvent",this.onUserEvent)})}disconnect(){if([...this.eventsAfterPerObject.values()].some(e=>e.length)){let{domElement:e,isExport:t}=this.eventContext,n=t?document:e;n.removeEventListener("pointerdown",this.onMouseDown),n.removeEventListener("mousedown",this.onMouseDown),document.removeEventListener("keydown",this.onKeyDown),n.removeEventListener("pointerdown",this.onAny),n.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.removeEventListener("userEvent",this.onUserEvent),t.forEach(e=>e.disconnect())})}[...this.eventsPerObject.entries()].forEach(([e,t])=>{e.removeEventListener("userEvent",this.onUserEvent),t.forEach(e=>e.disconnect())}),this.eventsPerObject.clear(),this.eventsAfterPerObject.clear()}},ln=class{constructor(e,t,n,r,i){this.publish=e,this.controlsManager=t,this.animationControls=n,this.eventContext=r,this.sharedVariables=i,this.isEnabled=!1,this.activateCount=0,this.needsMouse=!1,this.needsRaycast=!1,this.onTouchMovePreventScroll=e=>{let t=window.parent!==window,n=document.documentElement.scrollHeight>document.documentElement.clientHeight||document.documentElement.scrollWidth>document.documentElement.clientWidth;(e.touches.length>1||this.preventTouchScroll||!1===t&&!1===n)&&e.preventDefault()},this.onMouseWheelPreventScroll=e=>{this.preventScroll&&e.preventDefault()},this.onMouseMove=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:e.buttons>0}},this.onMouseDown=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:!0}},this.onMouseUp=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:!1}},this.getMousePosition=e=>{let{domRect:t}=this.eventContext,{pageX:n,pageY:r}=e.touches?.length>0?e.touches[0]:e;return{x:n-(t.left+window.scrollX),y:r-(t.top+window.scrollY)}},this.stopRaycast=e.stopRaycast,this.preventScroll=e.preventScroll,this.preventTouchScroll=e.preventTouchScroll,this.hideCursor=e.hideCursor,this.requestRender=r.requestRender}warnMissingEventFeatures(){this.eventContext.page.traverseEntity(e=>{for(let t of e.dataPatched.events){if(!0===t.data.disabled)continue;let e=t.data.type;if(void 0!==this.handlers[e])continue;let n=Z[e];void 0!==n&&he(n,`a "${e}" event`)}})}activate(e=!1){if(this.isEnabled)return;this.isEnabled=!0,this.initializeActionsDependentStates(),this.needsMouse&&(this.eventContext.domElement.addEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.addEventListener("pointerdown",this.onMouseDown));let t={eventContext:this.eventContext,eventManager:this,sharedVariables:this.sharedVariables,needsMouse:this.needsMouse,needsRaycast:this.needsRaycast};this.handlers={};let n=(e,n)=>{let r=y(e);void 0!==r?this.handlers[e]=r(t):void 0!==n&&(this.handlers[e]=n())};n("Spline",()=>new f(this.eventContext)),n("VariableChange"),n("API"),n("WEBHOOK"),n("AIAssistantListener"),n("AIAssistantTrigger"),n("Conditional"),n("Start",()=>new on(this.eventContext,this)),n("Basic",()=>new en(this.eventContext,this,this.needsRaycast)),n("MouseHover"),n("Scroll"),n("Follow"),n("DragDrop"),n("LookAt"),n("Resize"),n("Textfields"),this.warnMissingEventFeatures();let{page:r,domElement:i}=this.eventContext;this.hideCursor&&(i.style.cursor="none"),r.traverseEntity(e=>{e.addEventListener("requestRender",this.requestRender)}),Object.values(this.handlers).forEach(e=>e.connect()),i.addEventListener("wheel",this.onMouseWheelPreventScroll),i.addEventListener("touchmove",this.onTouchMovePreventScroll),this.activateCount++,e||this.eventContext.sharedAssets.openAIRealtime?.connect()}deactivate(e=!1){if(!this.isEnabled)return;this.isEnabled=!1,this.eventContext.domElement.removeEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.removeEventListener("pointerdown",this.onMouseDown),this.eventContext.domElement.removeEventListener("pointerup",this.onMouseUp),this.eventContext.sharedAssets.mouseProperty=null,this.eventContext.sharedAssets.raycastProperty=null;let{page:t,domElement:n}=this.eventContext;n.style.cursor="",Object.values(this.handlers).forEach(e=>e.disconnect()),this.controlsManager.gameControl?.disposeActions(),this.controlsManager.disconnectEvents(),t.traverseEntity(e=>{e.removeEventListener("requestRender",this.requestRender),e.destroyedInAction=!1}),n.removeEventListener("touchmove",this.onTouchMovePreventScroll),n.removeEventListener("wheel",this.onMouseWheelPreventScroll),this.animationControls.onExitPlayMode(),e||this.eventContext.sharedAssets.openAIRealtime?.disconnect()}dispose(){this.deactivate(),Object.values(this.handlers).forEach(e=>e.dispose())}get isPaused(){return this.isEnabled}pause(){this.deactivate()}resume(){this.activate()}reset(){this.deactivate(!0),this.activate(!0),this.controlsManager.deactivate(),this.controlsManager.activate(this),this.controlsManager.page.updateMatrixWorld(!0),this.controlsManager.rebuildBVH()}updateUseWindowEvents(e){let t=this.isEnabled;t&&this.deactivate(),this.eventContext.useWindowEvents=e,t&&this.activate()}initializeActionsDependentStates(){let e=this.eventContext.sharedAssets;e.resetDynamicVariablePlayState();let t=n=>{if("Conditional"===n.data.type&&(n.data.ifActions.forEach(t),n.data.elseActions.forEach(t)),"Conditional"===n.data.type||"SetVariable"===n.data.type)for(let e of"Conditional"===n.data.type?n.data.condition:n.data.expression)"id"in e&&Array.isArray(e.id)&&("mouse"===e.id[0]&&(this.needsMouse=!0),"raycast"===e.id[0]&&(this.needsRaycast=!0));"DynamicVariablePlay"===n.data.type&&""!==n.data.variableId&&("Play"===n.data.mode||"PlayPause"===n.data.mode||"Toggle"===n.data.mode)&&e.setDynamicVariablePlayState(n.data.variableId,"Stopped")};this.eventContext.page.traverseEntity(e=>{if(e.data?.events.length)for(let n of e.data.events)if("VariableChange"===n.data.type&&("mouseProperty"===n.data.variableId&&(this.needsMouse=!0),"raycastProperty"===n.data.variableId&&(this.needsRaycast=!0)),"Conditional"===n.data.type)for(let e of["inActions","outActions"])n.data[e].forEach(t);else if("DragDrop"===n.data.type)for(let e of["drag","drop"])n.data.dragDropActions[e].forEach(t);else if("GameControl"===n.data.type)for(let e of["idle","move","jump","run"])n.data.gameActions[e].forEach(t);else if("Resize"===n.data.type)for(let e of n.data.breakpoints)e.data.actions.forEach(t);else"LookAt"===n.data.type||"API"===n.data.type||n.data.actions.forEach(t)})}},cn=class{constructor(e,t,n,r){this.enableResponsive=!1,this._renderer=e,this._camera=t,this._frameSize=(new $e).copy(n),this._fov=r??t.fov}set frameSize(e){this._frameSize.copy(e)}setRenderSize(e,t){this._renderSize=void 0===e||void 0===t?void 0:new $e(e,t)}updateRenderer(){if(!this._renderer)return;let e=this._renderSize??this._frameSize;this._renderer.setSize(e.x,e.y)}updateViewport(){if(!this._renderer||!this._camera||"PerspectiveCamera"!==this._camera.cameraType)return;let e=this._renderSize??this._frameSize;this._renderer.setViewport(0,0,e.x,e.y)}updateCamera(){!this._camera||("PerspectiveCamera"===this._camera.cameraType?(this._camera.aspect=this._frameSize.x/this._frameSize.y,this._camera.updateProjectionMatrix()):this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y,this.enableResponsive))}setCamera(e){this._camera=e,this._fov=e.fov}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t,this.enableResponsive),this._camera.updateProjectionMatrix())}},hn=["particles","hair","shape-blends","vector-shapes","3d-paths","cloners","components","text","ui-2d","game-controls","collision-bvh","transitions"];function dn(e,t){if("Page"===e.type){let n=e.timelines;(void 0===n||Object.keys(n).length>0)&&t.add("timeline")}switch(e.type){case"Particle":case"ParticleCollider":t.add("particles");break;case"Hair":t.add("hair");break;case"Page":{null!=e.publish?.gameControlObject&&t.add("game-controls"),(null!=e.uiScene||void 0!==e.uiFrame)&&t.add("ui-2d");let n=e.uiScene?.objects;if(void 0!==n){if("function"!=typeof n.traverse)throw new Error("unrecognized uiScene shape");n.traverse((e,n)=>{dn(n,t)})}break}}switch(e.geometry?.type){case"ShapeBlendGeometry":t.add("shape-blends");break;case"VectorGeometry":t.add("vector-shapes");break;case"PathGeometry":t.add("3d-paths");break;case"UIGeometry":t.add("ui-2d");break;case"TextGeometry":case"InputGeometry":t.add("text")}("Component"===e.type||"Instance"===e.type)&&t.add("components"),null!=e.cloner&&t.add("cloners");let n=e.states;if(null!=n)if(Array.isArray(n))n.length>0&&t.add("transitions");else{if("object"!=typeof n)throw new Error("unrecognized states shape");Object.keys(n).length>0&&t.add("transitions")}}function un(e,t){if(e&&(e.data&&dn(e.data,t),e.children))for(let n of e.children)un(n,t)}var pn,mn,fn=class{get sharedAssets(){return this.shared}constructor(e,t={},n=!0,{dedupeParametricGeometries:r=!1}={}){this.shared=new z(e.shared,t,!0,n),this.shared.geometryCache.dedupeByValue=r,this.scene=new a(e.scene,this.sharedAssets),this.shared.setEntityOpContext({scene:this.scene,shared:this.shared})}reset(e,t){this.scene.clearScene(),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}resetPersonalCameraFromDocumentData(){for(let e of this.scene.children)e instanceof x&&!e.uiScene&&e.personalCamera.updateState(e.data.camera,{scene:this.scene,shared:this.shared})}dispose(){this.scene.dispose(),this.shared.dispose()}gc(){this.scene.releaseInstanceGroups(),this.shared.geometryCache.startGc(),this.shared.geometryCache2.startGc(),this.scene.traverseEntity(e=>{e instanceof H&&e.markGeometryAsReachable(this.shared)}),this.shared.geometryCache.endGc(),this.shared.geometryCache2.endGc()}},vn="vertexOrder";function yn(e){return mn||(mn=import("./runtime-DRACOLoader-SDMMLQLV.js").then(({DRACOLoader:t})=>((pn=new t).setDecoderPath(void 0!==e?`${e}/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload(),pn.decoderPending))),mn}async function gn(e){if(pn){let t,n={attributeIDs:{...pn.defaultAttributeIDs,[vn]:"GENERIC"},attributeTypes:{...pn.defaultAttributeTypes,[vn]:"Uint32Array"},useUniqueIDs:!1};try{t=await pn.decodeGeometry(new Int8Array(e).buffer,n)}catch(e){console.error(e)}if(t)return function(e){let t=e.attributes.find(e=>e.name===vn);if(!t)return e;let n=t.array,r=n.length,i=0;for(let e=0;e<r;e++)i=Math.max(i,n[e]+1);let s,a=e.attributes.filter(e=>e!==t).map(({name:e,itemSize:t,array:s})=>{let a=new Float32Array(i*t);for(let e=0;e<a.length;e++)a[e]=s[e%t];for(let e=0;e<r;e++){let r=n[e]*t,i=e*t;for(let e=0;e<t;e++)a[r+e]=s[i+e]}return{name:e,itemSize:t,array:a}});if(e.index){let t=e.index.array,r=new Uint32Array(t.length);for(let e=0;e<t.length;e++)r[e]=n[t[e]];s={array:r}}return{index:s,attributes:a}}({index:t.index?{array:t.index.array}:void 0,attributes:Object.entries(t.attributes).map(([e,t])=>({name:e,itemSize:t.itemSize,array:t.array}))})}return null}async function bn(e){for(let t of e){let e=await gn(t.geometry.data.draco);if(e){let n=t.geometry.data;e.index&&(n.index={array:e.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let r={};e.attributes.forEach(({name:e,array:t,itemSize:n})=>{r[e]={array:t,itemSize:n,type:"Float32Array",normalized:!1}}),n.attributes=r,n.draco=void 0}}}var wn={bloom:()=>import("./runtime-bloom-BCIKZBEA.js"),chromaticAberration:()=>import("./runtime-chromaticAberration-3RHGUSI4.js"),vignette:()=>import("./runtime-vignette-M335YXIJ.js"),noise:()=>import("./runtime-noise-7B3N6OON.js"),hueSaturation:()=>import("./runtime-hueSaturation-EW54YMQI.js"),brightnessContrast:()=>import("./runtime-brightnessContrast-4RZUU364.js"),depthOfField:()=>import("./runtime-depthOfField-CMLWIQFI.js"),pixelation:()=>import("./runtime-pixelation-TZDENYAX.js")},En={bloom:()=>import("./runtime-fxBloom-J7DP6U3W.js"),depthOfField:()=>import("./runtime-fxDepthOfField-CGEBUOHG.js")};function _n(e,t,n){return Promise.all(e.map(e=>t[e]?.().catch(t=>{console.warn(`[spline] Failed to load the ${e} postprocessing effect (${n}); the effect will be skipped.`,t)}))).then(()=>{})}function jn(e){return _n(e,wn,"webgl")}var Pn=new WeakMap,Mn=new WeakMap;function Cn(e,t,n){let r=i=>{e.removeEventListener(t,r,!0),i.stopImmediatePropagation(),n(i)};return e.addEventListener(t,r,!0),()=>e.removeEventListener(t,r,!0)}var On=it(st(),1);function An(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function xn(e){return{id:e.uuid,name:e.name,type:e.object.data?.type??e.object.type,visible:!1!==e.playModeVisible,position:{x:e.position.x,y:e.position.y,z:e.position.z},rotation:{x:e.rotation.x*Fe.RAD2DEG,y:e.rotation.y*Fe.RAD2DEG,z:e.rotation.z*Fe.RAD2DEG},scale:{x:e.scale.x,y:e.scale.y,z:e.scale.z},spawned:!0}}function Sn(e){return{id:e.uuid,name:e.name,type:e.type??"Object",visible:e.visible,position:{x:e.position.x,y:e.position.y,z:e.position.z},rotation:{x:e.rotation.x*Fe.RAD2DEG,y:e.rotation.y*Fe.RAD2DEG,z:e.rotation.z*Fe.RAD2DEG},scale:{x:e.scale.x,y:e.scale.y,z:e.scale.z}}}function kn(e,n,r){let i=t=>e.findObjectById(t)??e.findObjectByName(t),s=new Map,a=e=>{let t=s.get(e);if(t)return t;for(let t of s.values())if(t.name===e)return t};return{setVariable:(t,n)=>t in e.getVariables()?(e.setVariable(t,n),{ok:!0}):{ok:!1,warning:`spline.setVariable: no variable named "${t}" in this scene.`},getVariable:t=>e.getVariable(t),getVariables:()=>e.getVariables(),getAllObjects:()=>e.getAllObjects().map(Sn),findObject:e=>{let t=i(e);return t?Sn(t):void 0},getGeometry:(e,t)=>{if(!r)return{warning:"spline.getGeometry: not available in this runtime integration."};let n=a(e),s=n?n.object:(()=>{let t=i(e);return t?r.findEntity(t.uuid):void 0})();if(!s)return{warning:`spline.getGeometry: no object named "${e}" (names/ids come from getAllObjects).`};let o,l=n??s;"world"===t.space&&(l.updateWorldMatrix?.(!0,!1),o=l.matrixWorld?.elements);let c=function(e,t){let n=e?.getAttribute("position");if(!n||!n.count)return null;let r=n.count,i=t??null,s=e.getIndex?.()??null,a=Math.floor((s?s.count:r)/3),o=1/0,l=1/0,c=1/0,h=-1/0,d=-1/0,u=-1/0,p=new Float32Array(3*r);for(let e=0;e<r;e++){let t=n.getX(e),r=n.getY(e),s=n.getZ(e);i&&([t,r,s]=Ft(i,t,r,s)),t<o&&(o=t),r<l&&(l=r),s<c&&(c=s),t>h&&(h=t),r>d&&(d=r),s>u&&(u=s),p[3*e]=t,p[3*e+1]=r,p[3*e+2]=s}let m={space:i?"world":"local",vertexCount:r,triangleCount:a,indexed:null!==s,bounds:{min:[o,l,c],max:[h,d,u],size:[h-o,d-l,u-c]},vertices:p};if(s){let e=new Uint32Array(s.count);for(let t=0;t<s.count;t++)e[t]=s.getX(t);m.indices=e}let f=e.getAttribute("normal");if(f&&f.count===r){let e=i?function(e){let t=e[0],n=e[4],r=e[8],i=e[1],s=e[5],a=e[9],o=e[2],l=e[6],c=e[10],h=t*(s*c-a*l)-n*(i*c-a*o)+r*(i*l-s*o);if(!isFinite(h)||Math.abs(h)<1e-12)return null;let d=1/h,u=[(s*c-a*l)*d,(r*l-n*c)*d,(n*a-r*s)*d,(a*o-i*c)*d,(t*c-r*o)*d,(r*i-t*a)*d,(i*l-s*o)*d,(n*o-t*l)*d,(t*s-n*i)*d];return[u[0],u[3],u[6],u[1],u[4],u[7],u[2],u[5],u[8]]}(i):void 0;if(!i||e){let t=new Float32Array(3*r);for(let n=0;n<r;n++){let r=f.getX(n),i=f.getY(n),s=f.getZ(n);if(e){let t=e[0]*r+e[1]*i+e[2]*s,n=e[3]*r+e[4]*i+e[5]*s,a=e[6]*r+e[7]*i+e[8]*s,o=Math.hypot(t,n,a);o>1e-12?(r=t/o,i=n/o,s=a/o):(r=t,i=n,s=a)}t[3*n]=r,t[3*n+1]=i,t[3*n+2]=s}m.normals=t}}let v=e.getAttribute("uv");if(v&&v.count===r){let e=new Float32Array(2*r);for(let t=0;t<r;t++)e[2*t]=v.getX(t),e[2*t+1]=v.getY(t);m.uvs=e}return m}(s.geometry,o);return c?{data:{id:l.uuid,name:l.name,geometry:s.data?.geometry?.type,...c}}:{warning:`spline.getGeometry: "${l.name}" has no readable geometry — only meshes do (lights, cameras and groups have none; read a group's child meshes instead).`}},updateObject:(t,n)=>{let s=a(t);if(s){let{position:t,rotation:r,scale:i,visible:a}=n;return t&&("number"==typeof t.x&&(s.position.x=t.x),"number"==typeof t.y&&(s.position.y=t.y),"number"==typeof t.z&&(s.position.z=t.z)),r&&("number"==typeof r.x&&(s.rotation.x=r.x*Fe.DEG2RAD),"number"==typeof r.y&&(s.rotation.y=r.y*Fe.DEG2RAD),"number"==typeof r.z&&(s.rotation.z=r.z*Fe.DEG2RAD)),i&&("number"==typeof i.x&&(s.scale.x=i.x),"number"==typeof i.y&&(s.scale.y=i.y),"number"==typeof i.z&&(s.scale.z=i.z)),"boolean"==typeof a&&(s.playModeVisible=a),s.updateMatrix(),e.requestRender(),!0}let o=i(t);if(!o)return!1;let{position:l,rotation:c,scale:h,visible:d,geometry:u,material:p}=n;if(u&&"object"==typeof u&&r){let e=r.findEntity(o.uuid);if(e){let{vertices:t,normals:n,uvs:i,indices:s,...a}=u;An(t)&&r.shared.updateEntityGeometryVertices(e,{vertices:t,normals:An(n)?n:void 0,uvs:An(i)?i:void 0,indices:An(s)?s:void 0}),Object.keys(a).length>0&&r.shared.updateEntityGeometryParams(e,a)}}if(p&&"object"==typeof p&&r){let e=r.findEntity(o.uuid);e&&r.shared.updateEntityMaterialParams(e,p)}return l&&("number"==typeof l.x&&(o.position.x=l.x),"number"==typeof l.y&&(o.position.y=l.y),"number"==typeof l.z&&(o.position.z=l.z)),c&&("number"==typeof c.x&&(o.rotation.x=c.x*Fe.DEG2RAD),"number"==typeof c.y&&(o.rotation.y=c.y*Fe.DEG2RAD),"number"==typeof c.z&&(o.rotation.z=c.z*Fe.DEG2RAD)),h&&("number"==typeof h.x&&(o.scale.x=h.x),"number"==typeof h.y&&(o.scale.y=h.y),"number"==typeof h.z&&(o.scale.z=h.z)),"boolean"==typeof d&&(o.visible=d),e.requestRender(),!0},createObject:async(t,n)=>Sn(await e.createObject(t,n)),createCustomMaterial:t=>e.createCustomMaterial(t),getTexture:(e,t)=>{if(!r)return null;let n=i(e),s=n?r.findEntity(n.uuid):void 0;if(!s)return null;let a=r.shared.getEntityTexture(s,t??{});return a?{texture:a.texture,width:a.width,height:a.height,layer:a.layerType}:null},setMaterial:(t,n)=>e.setMaterial(t,n),cloneObject:(t,n)=>Sn(e.cloneObject(t,n)),removeObject:t=>e.removeObject(t),spawnObject:(t,n)=>{if(!r)return{warning:"spline.spawnObject: not available in this runtime integration."};let a=i(t),o=a?r.findEntity(a.uuid):void 0;if(!o)return{warning:`spline.spawnObject: no object named "${t}" to use as a template.`};if(s.size>=500)return{warning:"spline.spawnObject: spawn budget reached (500 live copies) — destroyObject old copies (or reuse them) instead of spawning more."};let l=r.shared.spawnRuntimeClone(o,n??{});return l?(s.set(l.uuid,l),e.requestRender(),{object:xn(l)}):{warning:`spline.spawnObject: "${t}" cannot be spawned from.`}},destroyObject:t=>{let n=a(t);return!(!r||!n||(s.delete(n.uuid),r.shared.destroyRuntimeClone(n),e.requestRender(),0))},setInstanceTransforms:(t,n)=>{if(!r)return-1;let s=i(t),a=s?r.findEntity(s.uuid):void 0;if(!a)return-1;let o=r.shared.setEntityInstanceTransforms(a,n);return o>=0&&e.requestRender(),o},...t(()=>r?.getAnimationControls(),e=>{let t=i(e);return t?r?.findEntity(t.uuid):void 0}),emitEvent:(e,t,n)=>{let r=i(t);return r?(n?r.emitEventReverse(e):r.emitEvent(e),{ok:!0}):{ok:!1,warning:`spline.emitEvent: no object named "${t}".`}},requestRender:()=>e.requestRender(),addSplineEventListener:(t,n)=>{let r=e=>{n({target:{id:e.target?.id??"",name:e.target?.name??""}})};return e.addEventListener(t,r),()=>e.removeEventListener(t,r)},getCanvas:()=>n}}var Rn=class{constructor(e,t,n){this.iframe=e,this.bridge=t,this.observer=n}static mount(e,t,n,r){if(typeof document>"u")return null;let i=t.parentElement;if(!i)return null;"static"===getComputedStyle(i).position&&(i.style.position="relative");let s=document.createElement("iframe");s.setAttribute("sandbox","allow-scripts allow-forms allow-pointer-lock"),s.title="Spline HTML content";let a=s.style;a.position="absolute",a.border="0",a.background="transparent",a.pointerEvents="auto",a.colorScheme="normal";let o=()=>{a.left=`${t.offsetLeft}px`,a.top=`${t.offsetTop}px`,a.width=`${t.offsetWidth}px`,a.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(i),s.srcdoc=function(e){let t=`<script>${zt}<\/script>`,n=/<head(\s[^>]*)?>/i.exec(e);if(n){let r=n.index+n[0].length;return e.slice(0,r)+t+e.slice(r)}let r=/<html(\s[^>]*)?>/i.exec(e);if(r){let n=r.index+r[0].length;return e.slice(0,n)+`<head>${t}</head>`+e.slice(n)}return t+e}(n),i.insertBefore(s,t.nextSibling);let c=new $t(s,kn(e,t,r),(e,t)=>{"warn"===e?console.warn(`[spline html] ${t}`):"error"===e&&console.error(`[spline html] ${t}`)});return c.attach(),new Rn(s,c,l)}dispose(){this.bridge.dispose(),this.observer.disconnect(),this.iframe.remove()}},Tn="data-spline-html-content",Dn=`\n[${Tn}] { pointer-events: none; }\n[${Tn}] > * { pointer-events: auto; }\n[${Tn}] [data-spline-passthrough] { pointer-events: none; }\n`,Ln=class{constructor(e,t,n,r,i,s){this.container=e,this.host=t,this.observer=n,this.spline=r,this.previousSplineGlobal=i,this.removeLateLifecycleShim=s}static mount(e,t,n,r){if(typeof document>"u")return null;let i=t.parentElement;if(!i)return null;"static"===getComputedStyle(i).position&&(i.style.position="relative");let s=document.createElement("div");s.setAttribute(Tn,"");let a=s.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${t.offsetLeft}px`,a.top=`${t.offsetTop}px`,a.width=`${t.offsetWidth}px`,a.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(i);let c=document.createElement("style");c.textContent=Dn,s.appendChild(c);let h=(new DOMParser).parseFromString(n,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let e of d)e.remove();for(let e of Array.from(h.head.children))("STYLE"===e.tagName||"LINK"===e.tagName&&"stylesheet"===e.rel)&&s.appendChild(e);for(;h.body.firstChild;)s.appendChild(h.body.firstChild);i.insertBefore(s,t.nextSibling),s.addEventListener("wheel",e=>{e.ctrlKey&&!e.defaultPrevented&&!t.dispatchEvent(new WheelEvent("wheel",e))&&e.preventDefault()},{passive:!1});let u=new Map,p=new Ht(kn(e,t,r),(e,t)=>{"warn"===e?console.warn(`[spline html] ${t}`):"error"===e&&console.error(`[spline html] ${t}`)},(e,t)=>{let n=u.get(e);if(n)for(let e of n)try{e(t)}catch(e){console.error(e)}}),m=(e,t)=>{try{return Promise.resolve(p.execute(e,t))}catch(e){return Promise.reject(e)}},f={ready:Promise.resolve(),setVariable:(e,t)=>m("setVariable",[e,t]),setVariables:e=>m("setVariables",[e]),getVariable:e=>m("getVariable",[e]),getVariables:()=>m("getVariables",[]),getAllObjects:()=>m("getAllObjects",[]),findObjectByName:e=>m("findObjectByName",[e]),findObjectById:e=>m("findObjectById",[e]),getGeometry:(e,t)=>m("getGeometry",[e,t??{}]),updateObject:(e,t)=>m("updateObject",[e,t]),createObject:(e,t)=>m("createObject",[e,t??{}]),createCustomMaterial:e=>m("createCustomMaterial",[e]),getTexture:(e,t)=>m("getTexture",[e,t??{}]),setMaterial:(e,t)=>m("setMaterial",[e,t]),cloneObject:(e,t)=>m("cloneObject",[e,t??{}]),removeObject:e=>m("removeObject",[e]),spawnObject:(e,t)=>m("spawnObject",[e,t??{}]),destroyObject:e=>m("destroyObject",[e]),setInstanceTransforms:(e,t)=>m("setInstanceTransforms",[e,t??null]),getAnimations:e=>m("getAnimations",[e]),playAnimation:(e,t,n)=>m("playAnimation",[e,t,n]),pauseAnimation:(e,t)=>m("pauseAnimation",[e,t]),stopAnimation:(e,t)=>m("stopAnimation",[e,t]),emitEvent:(e,t)=>m("emitEvent",[e,t]),emitEventReverse:(e,t)=>m("emitEventReverse",[e,t]),requestRender:()=>m("requestRender",[]),addEventListener:(e,t)=>{if("function"!=typeof t)return;let n=u.get(e);n||(n=new Set,u.set(e,n),m("listenEvent",[e])),n.add(t)},removeEventListener:(e,t)=>{let n=u.get(e);!n||(n.delete(t),0===n.size&&(u.delete(e),m("unlistenEvent",[e])))}},v=window.spline;window.spline=f;let y=function(){if(typeof document>"u"||"loading"===document.readyState)return()=>{};let e=[],t=(t,n)=>{let r=new Set,i=t.addEventListener.bind(t),s=t.removeEventListener.bind(t);Object.defineProperty(t,"addEventListener",{configurable:!0,writable:!0,value:(e,s,a)=>{if(i(e,s,a),!n.includes(e)||null==s)return;let o={type:e,listener:s};r.add(o),queueMicrotask(()=>{!r.delete(o)||((e,t,n)=>{let r=new Event(n);try{"function"==typeof t?t.call(e,r):t.handleEvent?.(r)}catch(e){console.error(e)}})(t,o.listener,o.type)})}}),Object.defineProperty(t,"removeEventListener",{configurable:!0,writable:!0,value:(e,t,n)=>{s(e,t,n);for(let n of r)n.type===e&&n.listener===t&&r.delete(n)}}),e.push(()=>{delete t.addEventListener,delete t.removeEventListener,r.clear()})};t(document,["DOMContentLoaded"]),t(window,["load"]);let n=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:e=>{"function"==typeof e&&queueMicrotask(()=>{try{e.call(window,new Event("load"))}catch(e){console.error(e)}})}}),e.push(()=>{n?Object.defineProperty(window,"onload",n):delete window.onload}),()=>{for(let t of e)t()}}();for(let e of d){let t=document.createElement("script");for(let n of Array.from(e.attributes))t.setAttribute(n.name,n.value);e.src?t.async=!1:t.textContent=e.textContent,s.appendChild(t)}return new Ln(s,p,l,f,v,y)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline===this.spline&&(window.spline=this.previousSplineGlobal)}};function Vn(e){return"object"==typeof e&&null!==e&&!0===e.isMaterial}function In(e){if("function"==typeof e.material)throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation — this entry point does not support it.");if(!Vn(e.material))return{options:e};let t=e.material;if(!0===t.isNodeMaterial){let n=U()?.NodeMaterial;if(void 0!==n&&t instanceof n)return{options:{...e,material:void 0},material:t};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => …) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, …).")}if(!0===t.isShaderMaterial)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend — port the shader to TSL with app.createCustomMaterial((three) => …), or use a built-in material (MeshStandardMaterial, …).");return{options:{...e,material:void 0},material:t}}var Un=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),Gn="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",Bn={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},Kn={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},Nn={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data — clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data — clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data — clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime — clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto — clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame — clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime — clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime — clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime — clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime — clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor — clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},zn={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},Wn={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function Hn(e,t){return void 0===e?[t[0],t[1],t[2]]:Array.isArray(e)?[e[0]??t[0],e[1]??t[1],e[2]??t[2]]:[e.x??t[0],e.y??t[1],e.z??t[2]]}function Fn(e){return"number"==typeof e?[e,e,e]:Hn(e,[1,1,1])}function $n(e){let t=new K(0,0,0,1);return t.setStyle(e),{r:t.r,g:t.g,b:t.b}}function qn(e,t){let n=e.material??(void 0!==e.color?{color:e.color}:void 0);if(void 0===n)return Te.defaultColorMaterial(Yn(Ke),"physical","layer1","layer2");if("string"==typeof n){for(let[e,r]of Object.entries(t.shared.materials))if(e===n||r.name===n)return e;if(function(e){let t=e.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)||/^(rgb|hsl)a?\(/.test(t)||void 0!==Je.NAMES[t]}(n))return Te.defaultColorMaterial($n(n),"physical","layer1","layer2");throw new Error(`createObject: material '${n}' matches no shared material in this document (available: ${function(e){let t=Object.entries(e.shared.materials).map(([,e])=>`'${e.name}'`).filter(e=>"'undefined'"!==e);return t.length?t.join(", "):"(none)"}(t)}) and is not a valid CSS color.`)}if("function"==typeof n)throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation — this entry point does not support it.");if(Vn(n))throw new Error("createObject: a three.js material instance cannot be stored in the document — this entry point does not support it.");let r=void 0!==n.color?$n(n.color):Yn(Ke),i=Te.defaultColorMaterial(r,"physical","layer1","layer2"),s=i.layers.find(e=>"light"===e.data.type);if(s){let e={};void 0!==n.roughness&&(e.roughness=n.roughness),void 0!==n.metalness&&(e.metalness=n.metalness),void 0!==n.reflectivity&&(e.reflectivity=n.reflectivity),Object.assign(s.data,e)}if(void 0!==n.alpha){let e=i.layers.find(e=>"color"===e.data.type);e&&Object.assign(e.data,{alpha:n.alpha})}return i}function Yn(e){return{r:(e>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255}}function Xn(e){let t=Ge.defaultData("TextGeometry"),{text:n,...r}=e,i=r.fontSize;return void 0!==i&&void 0===r.width&&(r.width=350*i/16),void 0!==i&&void 0===r.height&&(r.height=50*i/16),Object.assign(t,r),void 0!==n&&Object.assign(t,{text:{textValue:String(n)}}),t}function Zn(e){return Array.isArray(e)?e:!ArrayBuffer.isView(e)||e instanceof DataView?null:Array.from(e)}function Jn(e,t){return Yt({userData:{type:e,...L[e].normalizeInputs({parameters:t})}})}function Qn(e,t,n){let{objectType:r,geometryType:i}=e,s=function(e){let t={};for(let[n,r]of Object.entries(e))!Un.has(n)&&void 0!==r&&(t[n]=r);return t}(t),a={states:new Re,events:new Re};if("Mesh"===r&&i){if("NonParametricGeometry"===i){let{geometry:e,doubleSide:r}=function(e){let t=Zn(e.vertices);if(!t||t.length<9||t.length%3!=0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let n=t.length/3;if(n>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${n}); keep it under 60000.`);let r=Zn(e.indices);if(r&&r.length){let e=r.find(e=>!Number.isInteger(e)||e<0||e>=n);if(void 0!==e)throw new Error(`createObject('CustomMesh'): index ${e} is out of range (mesh has ${n} vertices).`)}else r=null;let i=new nt;i.setAttribute("position",new tt(t,3));let s=Zn(e.normals),a=null!==s&&s.length===t.length;a&&i.setAttribute("normal",new tt(s,3));let o=Zn(e.uvs);o&&o.length===2*n&&i.setAttribute("uv",new tt(o,2));let l=!1;if(!a){let e=r??Array.from({length:n},(e,t)=>t),{closed:i,inverted:s}=function(e,t){let n=e.length/3,r=new Map,i=new Array(n);for(let t=0;t<n;t++){let n=`${Math.round(1e4*e[3*t])},${Math.round(1e4*e[3*t+1])},${Math.round(1e4*e[3*t+2])}`,s=r.get(n);void 0===s?(r.set(n,t),i[t]=t):i[t]=s}let s=new Map;for(let e=0;e+2<t.length;e+=3){let n=i[t[e]],r=i[t[e+1]],a=i[t[e+2]];for(let[e,t]of[[n,r],[r,a],[a,n]]){if(e===t)continue;let n=e<t?e+"_"+t:t+"_"+e;s.set(n,(s.get(n)??0)+1)}}let a=s.size>0;for(let e of s.values())if(2!==e){a=!1;break}if(!a)return{closed:!1,inverted:!1};let o=0;for(let n=0;n+2<t.length;n+=3){let r=3*t[n],i=3*t[n+1],s=3*t[n+2],a=e[r],l=e[r+1],c=e[r+2],h=e[i],d=e[i+1],u=e[i+2],p=e[s],m=e[s+1],f=e[s+2];o+=a*(d*f-u*m)+l*(u*p-h*f)+c*(h*m-d*p)}return{closed:!0,inverted:o<0}}(t,e);if(i&&s){for(let t=0;t+2<e.length;t+=3){let n=e[t+1];e[t+1]=e[t+2],e[t+2]=n}r=e}else i||(l=!0)}return r&&i.setIndex(r),a||i.computeVertexNormals(),{geometry:Yt({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:i.toJSON().data}),doubleSide:l}}(s);Object.assign(a,We.defaultData,{geometry:e,materials:[qn(t,n)]}),r&&(a.side=2)}else Object.assign(a,We.defaultData,{geometry:"TextGeometry"===i?Xn(s):Jn(i,s),material:qn(t,n)});void 0!==t.castShadow&&(a.castShadow=t.castShadow),void 0!==t.receiveShadow&&(a.receiveShadow=t.receiveShadow)}else"Empty"===r?Object.assign(a,ze.defaultData):(Object.assign(a,me.defaultData(r),s),void 0!==t.color&&(a.color=$n(t.color)));a.visible=t.visible??!0,a.position=Hn(t.position,[0,0,0]),a.rotation=Hn(t.rotation,[0,0,0]),a.scale=Fn(t.scale);let o=(i&&zn[i])??Wn[r]??r;return a.name=t.name??er(o,n.scene.objects),a}function er(e,t){let n=new Set;if(t.traverse((e,t)=>{n.add(t.name??"")}),!n.has(e))return e;let r=2;for(;n.has(`${e} ${r}`);)r++;return`${e} ${r}`}function tr(e,t){let n=Fe.generateUUID();if("Component"===e.data.type)return{data:{...fe.fromComponentData(e),name:e.data.name+" Instance"},id:n,fi:e.fi,children:[]};t[e.id]=n;let r=e.data;return"Empty"===r.type&&r.animations?.length&&(r={...r,animations:je(r.animations,Fe.generateUUID,t)}),{...e,id:n,data:r,children:e.children.map(e=>tr(e,t))}}function nr(e){let t={},n=tr(e,t);return De(n,t)}function rr(e){let t=Array.isArray(e)?e[0]:e,n=t.layers?.map(ir)??[],r=t.layers?.find(e=>"light"===e.type);return{layers:n,alpha:r?.node.alphaOverride?.value??1}}function ir(e){return"texture"===e.type||"video"===e.type||"matcap"===e.type?{...e.data,updateTexture:t=>e.color.texture.image.updateSrc(t)}:{...e.data}}var sr=new K(0,0,0,1),ar={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]},or=new $e;function lr(e){let t=new K(0,0,0,1);try{t.setStyle(e)}catch(e){console.error(e)}return t}var cr=class{constructor(e,{renderOnDemand:t,renderMode:n="auto",wasmPath:r,renderer:i,htmlContentMode:s="sandbox"}={}){if(this._rendererBackend="webgl",this._rendererAuto=!1,this._rendererConfigured=!1,this._startOrder=0,this._claimedOrder=0,this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._htmlContentMode="sandbox",this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=e=>{if(this.time=e,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),this._renderer)if(this._isPaused||!("manual"===this.renderMode&&!this._renderRequested||"auto"===this.renderMode&&this._skipRender)){if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<B?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(e=>{"ParticleSystem"===e.type&&(e.update(this.dt),this._skipRender=!1),ie(e)&&(!0!==this._renderer?.isWebGPUSplineRenderer&&e.warnClassicFallbackOnce(),e.isSimulating&&(e.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let e=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=e,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),!0===this._renderer.lastFrameIncomplete&&(this._skipRender=!1),!0===this._renderer.skyAnimationActive&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()}else this._perfs?.end();else this._perfs?.end()},this._resize=e=>{if(this._renderer){if(1===this._viewportMode&&this._frameView&&(this._frameView.frameSize=or.set(this._viewportWidth,this._viewportHeight)),e){let e=this._viewportWidth,t=this._viewportHeight;this._renderer.setSize(e-1,t-1,!1),this._renderer.setSize(e,t,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera&&(this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(),"PerspectiveCamera"===this._camera.cameraType&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=ne(this._resize,10),this._onScroll=e=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=e,this._htmlContentMode=s,this.renderMode=t?"auto":n,void 0!==r&&(this._wasmPath=re(r,"/")),this._rendererBackend=i??"webgl",void 0===i){let e=null;try{e=new URLSearchParams(window.location.search).get("renderer")}catch{}"webgpu"===e||"webgl"===e||"webgl2"===e?this._rendererBackend="webgl2"===e?"webgl":e:(this._rendererAuto=!0,this._rendererBackend=typeof navigator<"u"&&"gpu"in navigator?"webgpu":"webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&import("./runtime-Perfs-KMJFDYHU.js").then(({Perfs:e})=>{this._perfs=new e({x:10,y:10})}),O(e)}async _ensureRenderer(){return this._renderer?this._renderer:(this._rendererInit||(this._rendererInit=this._initRenderer().then(e=>(this._rendererInit=void 0,e&&(this._renderer=e),e),e=>{throw this._rendererInit=void 0,e})),this._rendererInit)}async _initRenderer(){if(this.disposed)return null;let e=await this._createRenderer();return this.disposed?(this._disposeRenderer(e),null):e}_disposeRenderer(e){let t=function(e){let t=e.backend;if(void 0!==t)return!0===t.isWebGLBackend?t.gl??null:null;let n=e.getContext,r="function"==typeof n?n.call(e):null;return r&&"function"==typeof r.getExtension?r:null}(e);if(t&&!function(e,t){return Mn.get(e)===t}(this.canvas,this))return n=e,void(!0===n.backend?.isWebGLBackend||e.dispose());var n;let r=t?function(e,t){let n=t.getExtension("WEBGL_lose_context");if(!n||t.isContextLost())return()=>{};let r=()=>{},i=new Promise(t=>{r=Cn(e,"webglcontextlost",e=>{e.preventDefault(),t(n)})});return Pn.set(e,{gl:t,lost:i,stopListening:r}),()=>{t.isContextLost()||n.loseContext()}}(this.canvas,t):void 0;try{e.dispose()}finally{r?.()}}async _createRenderer(){if(e=this.canvas,t=this,Mn.set(e,this),await async function(e){let t=Pn.get(e);if(t&&(t.restoring??(t.restoring=async function(e,t){if(!t.gl.isContextLost())return void t.stopListening();let n,r=()=>{},i=t.lost.then(t=>new Promise(n=>{r=Cn(e,"webglcontextrestored",()=>n()),t.restoreContext()})),s=new Promise(e=>{n=setTimeout(e,2e3)});await Promise.race([i,s]),clearTimeout(n),r(),t.stopListening()}(e,t).finally(()=>{t.restoring=void 0,!t.gl.isContextLost()&&Pn.get(e)===t&&Pn.delete(e)})),await t.restoring,t.gl.isContextLost()))throw new Error("[spline] The browser did not restore the WebGL context this canvas had before dispose(); the scene cannot render on it. Use a new canvas.")}(this.canvas),"webgpu"===this._rendererBackend&&this._rendererAuto)try{await(navigator.gpu?.requestAdapter())||(this._rendererBackend="webgl")}catch{this._rendererBackend="webgl"}var e,t;if("webgpu"===this._rendererBackend)try{let{createWebGPUSplineRenderer:e,isWebGPUSupported:t}=await import("./runtime-webgpu-NLOKHPVE.js");t();let n=!0,r=!1;try{let e=new URLSearchParams(window.location.search),t=e.get("bundles");"rerecord"===t?n="rerecord":("off"===t||"0"===t||"false"===t||"no"===t)&&(n=!1),r="1"===e.get("forcegl")}catch{}let i=await e({canvas:this.canvas,antialias:!1,alpha:!0,powerPreference:"high-performance",sceneBundles:!r&&n,forceWebGL:r,asyncCompilation:this._asyncShaderCompilation()});return i.onBackgroundWorkReady=()=>{this._skipRender=!1,this._renderRequested=!0},i.skyAnimationAllowed=!0,i}catch(t){console.error("[spline] Failed to initialize the WebGPU renderer, falling back to WebGL:",t),this._rendererBackend="webgl"}{let{SplineRenderer:e,rendererGlobals:t}=await import("./runtime-classicRuntime-7UEL6B3U.js");try{"off"===new URLSearchParams(window.location.search).get("taa")&&(t.taaEnabled.value=!1)}catch{}return new e({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}}_asyncShaderCompilation(){let e=!1!==this._data?.scene.publish?.asyncShaderCompilation;try{let t=new URLSearchParams(window.location.search);if("1"===t.get("forcegl"))return!1;let n=t.get("asynccomp");"off"===n||"0"===n||"false"===n||"no"===n?e=!1:("on"===n||"1"===n||"true"===n||"always"===n)&&(e=!0)}catch{}return e}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let e=window.devicePixelRatio||1,t=this.canvas.clientWidth||300,n=this.canvas.clientHeight||150;this.canvas.width=t*e,this.canvas.height=n*e;let r=this.canvas.getContext("2d");r&&(r.scale(e,e),r.fillStyle="rgba(127, 127, 127, 0.85)",r.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",r.textAlign="center",r.textBaseline="middle",r.fillText("This scene requires a WebGPU-capable browser.",t/2,n/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(e,t,n){(function(e){let t="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";e.endsWith(".spline")?console.warn(t+" The .spline files are only meant to be used by the Editor."):e.endsWith(".splinecode")||console.warn(t)})(e),this.disposed=!1;{let e=()=>{};import("./runtime-updater-KLVUIFCT.js").catch(e),"webgpu"===this._rendererBackend?import("./runtime-webgpu-NLOKHPVE.js").catch(e):import("./runtime-classicRuntime-7UEL6B3U.js").catch(e)}let r=await(await fetch(e,n)).arrayBuffer();await this.start(r,{variables:t})}async start(e,t={}){if(this.disposed)return;let n,r=++this._startOrder,i=()=>this._claimedOrder>r;return n=this._start(e,t,i,()=>!i()&&(this._claimedOrder=r,this._claimedStart=n,!0)).then(()=>i()?this._claimedStart:void 0,e=>{if(!i())throw e;return this._claimedStart}),n}async _start(t,{interactive:n=!0,variables:r},a,l){p.init();let c=await async function(e){let[t,n]=Ie(Ue.deserialize(new Uint8Array(e)));if(135!==(t.schema??0)){let{updateDocumentSchema:e}=await import("./runtime-updater-KLVUIFCT.js");e(t)}return n.result().data}(t);if(a())return;let h=function(e){let t=[];return e.scene.objects.traverse((e,n)=>{"Mesh"===n.type&&"NonParametricGeometry"===n.geometry.type&&void 0!==n.geometry.data.draco&&t.push(n)}),t}(c);c.version&&(0,On.default)(c.version,"2.0.160")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),void 0!==this._wasmPath&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),He(this._wasmPath));let d=async function(e){{let t={particles:()=>import("./runtime-particles-Z4L6HZL7.js"),hair:()=>import("./runtime-hair-6WVY27RG.js"),"shape-blends":()=>import("./runtime-shapeBlends-PDAXXKUK.js"),"vector-shapes":()=>import("./runtime-vectorShapes-DUPPP7JJ.js"),"3d-paths":()=>import("./runtime-paths-OB53G53L.js"),cloners:()=>import("./runtime-cloners-IV5JEXST.js"),components:()=>import("./runtime-components-ABF4V6NS.js"),text:()=>import("./runtime-text-YREQB5BX.js"),"ui-2d":()=>import("./runtime-ui2d-AEDWPLLS.js"),"game-controls":()=>import("./runtime-gameControls-AHOA36GR.js"),"collision-bvh":()=>import("./runtime-collisionBVH-JA4BEOA7.js"),mousehover:()=>import("./runtime-mouseHover-5TKLUE6P.js"),scroll:()=>import("./runtime-scroll-GPW7QYFP.js"),dragdrop:()=>import("./runtime-dragDrop-YWEZOTXF.js"),tracking:()=>import("./runtime-tracking-OWGVF3I3.js"),resize:()=>import("./runtime-resize-M7XLJK2Z.js"),conditional:()=>import("./runtime-conditional-HIFTAHKC.js"),variables:()=>import("./runtime-variables-4DRZPW6M.js"),"api-services":()=>import("./runtime-apiServices-FVML63XU.js"),"ai-assistant":()=>import("./runtime-aiAssistant-54YBNKZT.js"),textinputs:()=>import("./runtime-textInputs-EFSQQG2P.js"),audio:()=>import("./runtime-audio-AU7AV2IM.js"),video:()=>import("./runtime-video-5AHDWGIY.js"),"create-destroy":()=>import("./runtime-createDestroy-ZXW22GR2.js"),"scene-transition":()=>import("./runtime-sceneTransition-AU5Y32AU.js"),timeline:()=>import("./runtime-timeline-VMFKGIK3.js"),transitions:()=>import("./runtime-transitions-4G2IA576.js"),"misc-actions":()=>import("./runtime-miscActions-R35TOHOE.js")},n=function(e){let t=new Set,n=!1,r=!1;for(let i of J(e,e=>{"GameControl"===e&&(n=!0),"Trigger"===e&&(r=!0)}))t.add(i);try{e.scene.objects.traverse((e,n)=>{dn(n,t)});let n=e.shared.lib?.components;if(n){let e=Object.keys(n);e.length>0&&t.add("components");for(let r of e)un(n[r]?.asset,t)}}catch{for(let e of hn)t.add(e)}return n&&t.add("game-controls"),(r||t.has("game-controls"))&&t.add("collision-bvh"),t}(e);await Promise.all([...n].map(e=>t[e]()))}}(c);if(await Promise.all([d,h.length&&yn(this._wasmPath),S(c)&&te(this._wasmPath),q(c)&&$(this._wasmPath),T(c)&&D(this._wasmPath),be.physicsEnabled(c.scene.objects)&&E(this._wasmPath),F(c)&&g(),i(c)&&s(),X(c)&&Y(),b(c)&&d.then(()=>ue()?.loadHanaUIRUNTIME()),_(c)&&M(this._wasmPath)].filter(Boolean)),a()||h.length&&(await bn(h),a())||!l())return;this._data=c,this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let m=c.scene.publish.renderer;if(this._rendererAuto&&"webgl"===m)this._rendererBackend="webgl";else if(this._rendererAuto&&"webgpu"===m){let e="webgpu"===this._rendererBackend&&await(navigator.gpu?.requestAdapter().catch(()=>null));if(a())return;if(!e)return void this._failWebGPURequired();this._rendererAuto=!1}let f=function(e){let t=new Set;return e.scene.objects.traverse((e,n)=>{if("Page"!==n.type)return;let r=n.postprocessing;if(r&&"object"==typeof r&&!0===r.enabled)for(let[e,n]of Object.entries(r))"enabled"!==e&&n&&"object"==typeof n&&!0===n.enabled&&t.add(e)}),[...t]}(c);if("webgpu"===this._rendererBackend)try{await Promise.all([import("./runtime-webgpu-NLOKHPVE.js"),(v=f,_n(v,En,"webgpu"))]);let e=await this._ensureRenderer();if(a()||!e)return}catch(e){console.error("[spline] Failed to load the WebGPU material backend, using WebGL:",e),this._rendererBackend="webgl"}var v;if("webgpu"!==this._rendererBackend&&(await Promise.all([import("./runtime-classicRuntime-7UEL6B3U.js"),jn(f)]),a()))return;V("webgpu"===this._rendererBackend?"webgpu":"webgl");let y=new fn(c,{},!0,{dedupeParametricGeometries:!0});if(y.resetPersonalCameraFromDocumentData(),this._scene=y.scene,this._sharedAssetsManager=y.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:e}=await import("./runtime-mergeStaticGeometries-DUF2ZBXY.js");if(a())return;let t=performance.now();e(c,y.scene);let n=performance.now();console.log("Merged geometries in ",n-t," ms")}S(c)&&this._scene.traverse(e=>{R(e)&&e.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(e=>{le(e)&&e.pendingMediaLoad&&e.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(e=>{"ParticleSystem"===e.type&&(e.wakeUp(),e.data.autoPlay?e.start():e.stop()),ie(e)&&e.setPlayMode(!0)});let w=Object.keys(c.shared.fonts).flatMap(e=>{let t=this._sharedAssetsManager.getFont(e);return t?[t.loadingPromise]:[]});if(Promise.all(w).then(()=>{this.disposed||(y.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),F(c)&&j(c)&&(await Promise.all(w),a()))return;if(b(c)){let e=[];if(this._scene.traverseEntity(t=>{(oe(t)||t instanceof x)&&t.uiCanvas&&e.push(t.uiCanvas)}),await Promise.all(e.map(e=>e.promise)),a())return}this._scene.rewriteEventsBeforeGoToPlayMode(),o(this._scene.activePage,this._sharedAssetsManager);let C=await this._ensureRenderer();if(a()||!C)return;if(this._rendererConfigured||(this._rendererConfigured=!0,C.pipeline.enableUIOverlay(),C.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode)),C.hdTransmission=!0===c.scene.publish.hdTransmission,C.setPixelRatio(this._getPixelRatio(/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?c.scene.publish.settings.web.pixelRatioMobile:c.scene.publish.settings.web.pixelRatioDesktop)),C.setAsyncCompilationPolicy?.(this._asyncShaderCompilation()),c.shared.images.SplineWatermark){let e=this._sharedAssetsManager.getImage("SplineWatermark");if(await e.loadPromise,a())return;let t=e.getTexture(1001);C.pipeline.setWatermark(t)}else C.pipeline.setWatermark(null);i(c)&&this._scene.initializeSplatViewer(),void 0!==c.scene.blueNoiseTextureData&&C.pipeline.updateBlueNoiseTexture(c.scene.blueNoiseTextureData);let O=Object.values(c.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):("fullscreen"===O.preset?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=O.size[0],this._viewportHeight=O.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),C.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new cn(C,this._camera,new $e(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(O.allowResponsive??!1)&&"fullscreen"===O.preset),n){let t=new u(C,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,O);this._scene.updateMatrixWorld(!0),this._controls=new P(t),this._animationControls=new e(this._scene,this._requestRenderAutoMode),this._eventManager=new ln(c.scene.publish,this._controls,this._animationControls,t,c.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),void 0!==r&&this.setVariables(r),0===this.dt&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),n&&(this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0);let A=c.scene.publish.htmlContent?.html;if(n&&A&&"none"!==this._htmlContentMode){let e={shared:this._sharedAssetsManager,findEntity:e=>this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e),getAnimationControls:()=>this._animationControls};this._htmlContentOverlay=("inline"===this._htmlContentMode?Ln.mount(this,this.canvas,A,e):Rn.mount(this,this.canvas,A,e))??void 0}}setVariables(e){if(void 0!==this._data){let t=Object.entries(e);for(let[e,n]of t)this.setVariable(e,n)}}setVariable(e,t){let n=this._getVariableByName(e);if(n&&!("dynamicVariableType"in n.data)){if(null==t)return void console.warn(`Variable ${e} was not updated: received ${t}. Pass a number, boolean or string.`);let r=t;if("number"==typeof n.data.value){if(r="number"==typeof t?t:"boolean"==typeof t?!0===t?1:0:parseFloat(t),!Number.isFinite(r))return void console.warn(`Variable ${e} is a number variable and ${JSON.stringify(t)} cannot be converted to a number. The variable was not updated.`)}else"boolean"==typeof n.data.value?r="number"==typeof t?!!t:"boolean"==typeof t?t:"false"!==t.toLocaleLowerCase()&&!!t:"string"!=typeof n.data.value&&void 0!==n.data.value.textValue&&(r=t.toString());let i="string"==typeof r?{textValue:r}:r;this._sharedAssetsManager?.updateVariable(n.id,i),this.requestRender(),this._requestRenderAutoMode()}else void 0===n?console.warn(`No variable named ${e} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in n.data&&console.warn(`Dynamic variables like ${e} cannot be updated from code.`)}getVariables(){let e={};return this._data&&this._data.shared.variables.forEach(t=>{void 0===e[t.data.name]&&(e[t.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(t.id)))}),e}getVariable(e){let t=this._getVariableByName(e);if(t){let e=this._sharedAssetsManager.getVariable(t.id);return this._getVariableValue(e)}}_getVariableValue(e){return"string"!=typeof e&&Ee.isTextValue(e)?Ee.getDisplayedValue(e):e}_getVariableByName(e){if(this._data){if(this._variablesCache.has(e))return this._variablesCache.get(e);let t=this._data.shared.variables.find(t=>t.data.name===e);return t&&this._variablesCache.set(e,t),t}}_getPixelRatio(e){switch(e){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(e){let t=this._scene?.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){let t=this._scene?.getObjectByName(e);return this._createProxyObject(t)}getAllObjects(){let e=[];return this._scene?.traverseEntity(t=>{if(!(t.uuid===Be||this._scene.isInvisibleObjects(t)||t instanceof x)){let n=this._createProxyObject(t);n&&e.push(n)}}),e}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEvent(e)}emitEventReverse(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEventReverse(e)}addEventListener(e,t){this.canvas.addEventListener(e,t)}removeEventListener(e,t){this.canvas.removeEventListener(e,t)}setZoom(e){this._controls?.orbitControls instanceof w&&this._controls?.orbitControls.setZoom(e)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(e,t){this._viewportWidth=e,this._viewportHeight=t,this._viewportMode=2,this._resize()}setBackgroundColor(e){let t=lr(e);this._scene?.activePage.setBackgroundColor(t),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._claimedOrder=++this._startOrder,this._claimedStart=void 0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,N(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(e=>{Kt.unsubscribe(e)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer&&this._disposeRenderer(this._renderer),this._renderer=void 0,this._rendererConfigured=!1,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),void 0!==this._resizeObserverTimeout&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,A(this.canvas),document.removeEventListener("scroll",this._onScroll),p.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(e){this._eventManager?.updateUseWindowEvents(e)}get data(){return this._data}_createProxyObject(e){if(!this._scene)return;let t,i=this._scene;if(null==e)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);e.traverseAncestors(e=>{e instanceof x&&(t=e.name)});let s=this._sharedAssetsManager,o={shared:s,scene:this._scene},l=t=>{if(null===t||"Base State"===t)return null;if(t&&e.data.states){let n=e.data.states.find(e=>e.data.name===t);return n?n.id:void 0}},c="material"in e?e.material:void 0,h=e.materialOverride,d={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,type:e.data.type,page:t,material:h??(c?rr(c):void 0),parentUuid:e.parent instanceof x||e instanceof a?void 0:e.parent?.uuid,emitEvent(t){e.dispatchEvent({type:"userEvent",eventName:t})},emitEventReverse(t){e.dispatchEvent({type:"userEvent",eventName:t,reverse:!0})},hide(){e.visible&&(e.visible=!1,o.shared.requestRender())},show(){e.visible||(e.visible=!0,o.shared.requestRender())},get state(){let t=e.stateSelection;if(null!==t)return e.data.states.find(({id:e})=>e===t)?.data.name},set state(t){let n;if(void 0!==t){let r="string"==typeof t?e.data.states.find(({id:e})=>e===t):e.data.states[t];if(r)n=r.id;else{let e="string"==typeof t?l(t):void 0;e&&(n=e)}}e.changeSelectedState(n??null,o),e.currentState=n??null,e.dispatchEvent({type:"completeState",state:n??null}),o.shared.requestRender()},transition(t){let a=n();if(null===a)return he("transitions","obj.transition()"),{transition(e){return this},play(){return this},pause(){return this},reset(){return this},seek(e){return this}};let o,c,h=this,d=[],u=!1,m=()=>{c=new r({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},d.map(e=>e.runner))},f={update(e){c?.update(e),!0!==c?.isPlaying&&p.remove(f)}},v={transition({from:t,to:n,duration:r,delay:c,...u}){let p=l(t);void 0===p&&(p=o);let f=l(n);return o=f,d.push(new a(e,p,f,{state:f,repeat:0,delay:c??0,delayDirection:"start-once",direction:"normal",duration:r??1e3,...u,...6===u.easing?ge.defaultData:5===u.easing?we.defaultData:{}},s,!1,i.activePage,{onBegin:()=>{(t&&p||"Base State"===t&&!p)&&(h.state=p??void 0)},onComplete:()=>{h.state=f??void 0}})),m(),this},play(){return c?(u=!0,c.play(p.time),c.isPlaying&&p.add(f),this):this},pause(){return c?.stop(),p.remove(f),this},reset(){return this.pause(),u=!1,m(),c?.seek(0),this},seek(e){let t=d.reduce((e,t)=>e+t.runner.duration,0);return t>0&&c?.seek(e/1e3/t),this}};return v.transition(t),(t.autoPlay??!0)&&queueMicrotask(()=>{u||v.play()}),v},set color(t){let n=lr(t);if(k.is(e))return void(e.color=n);if(!("Mesh"===e.type&&"material"in e&&e instanceof W))return;let r={r:n.r,g:n.g,b:n.b,a:n.a},i=e.materialOverride;if(void 0!==i){let e=i.color;return void(!0===e?.isColor&&"function"==typeof e.setStyle&&(e.setStyle(t),o.shared.requestRender()))}let s=Array.isArray(e.material)?e.material[0]:e.material,a=s.data.layers.find(e=>"color"===e.data.type)?.id;if(a)s.updateByOp({type:0,path:["layers",a],props:{color:{...r}}},s.data,o);else{let e=s.data,t=e.layers.find(e=>"light"===e.data.type);if(!t)return;let n=0===e.layers.indexOf(t)?t:null,i=e.layers.at(n?e.layers.indexOf(n)+1:0),a={type:4,fi:n?n.fi+(i?(i.fi-n.fi)/2:1):i?i.fi/2:1,id:Fe.generateUUID(),data:{...ke.defaultData("color"),color:r},localIndex:0},l=e.layers.insertAfterHelper(n?.id??null,1),c=e.layers.runOp({...a,fi:l[0]}).data;Object.assign(s.data,{layers:c}),s.updateByOp({...a,path:["layers"]},s.data,o)}}},u=Kt(d,(t,n)=>{let r=e[t],i=t.split(".");"material"===i[0]&&c&&void 0===h&&function(e,t,n){let r=Array.isArray(n)?n[0]:n;if("layers"===e[0]){let n=parseInt(e[1]),i=r.layers[n],s=e[2];i&&s&&function(e,t,n){let r=e[0];try{if(function(e,t){return!!ar[t]?.includes(e)}(r,n.type,e.slice(1)))if("colors"===r){if(e.length<2)throw new Error("You cannot mutate the colors array, only its items");let i=parseInt(e[1]),s=n.getValue(r)?.[i];if(!s)throw new Error("Color index out of range");sr.setStyle(t),s.set(sr.r,sr.g,sr.b,sr.a)}else n.getValue(r)?.setStyle(t);else if("texture"===r||"video"===r){let r=n.color;!function(e,t,n,r){let i=e[0];if("repeat"===i||"offset"===i||"rotation"===i){let n=r.getNode("mat"),s=n&&"function"==typeof n.updateMatrix?n:r.getValue("mat");if(!s)return;if("rotation"===i)s.rotation=parseFloat(t);else{let n=e[1];if(void 0===n)t instanceof Array&&2===t.length&&Object.assign(s,{[i]:t});else{let e=s[i],r=0===parseInt(n)?[parseFloat(t),e[1]]:[e[0],parseFloat(t)];Object.assign(s,{[i]:r})}}s.updateMatrix()}else"wrapping"===i||"minFilter"===i||"magFilter"===i?"wrapping"===i?n.texture.wrap=t:n.texture[i]=t:"image"===i&&"data"===e[1]&&n.texture.image.updateSrc(t)}(e.slice(1),t,r,n)}else{let i=e[1],s=n.getValue(r);s?.isVector3&&void 0!==i||s?.isVector2&&void 0!==i?s.setComponent(parseInt(i),t):n.setValue(r,t)}}catch(e){console.error("Error setting material value",e)}}(e.slice(2),t,i)}else"alpha"===e[0]&&r.layers.forEach(e=>{"light"===e.type&&void 0!==e.node.alphaOverride&&(e.node.alphaOverride.value=t,t<1&&(r.transparent=!0))})}(i.slice(1),n,c),"object"!=typeof r&&Object.getOwnPropertyDescriptor(e,t)?.writable&&(e[t]=n),this._requestRenderAutoMode(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,u),u}setUIWasmUrl(e){de(e)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(e,t){let n;if("string"==typeof t){if(!t.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let e=await(await fetch(t)).arrayBuffer();n=new Uint8Array(e)}}else n=t;let r=Ue.deserialize(n),i="data"in r&&void 0!==r.data.draco;i&&await yn(this._wasmPath);let s=this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e);if(!s)return void console.warn(`Object ${e} not found`);if("Mesh"!==s.data.type||!(s instanceof W))return void console.warn(`Object ${e} is not a mesh`);let a=s,o={...a.data,geometry:r};i&&await bn([o]),a.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let e of a.data.states){let t={...e.data};a.states||(a.states={}),a.states[e.id]=ye.patch(o,t)}return n}_applyDocumentTransaction(e){this._data=e.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let t of e.actual){let e=t.path;Array.isArray(e)&&2===e.length&&"scene"===e[0]&&"objects"===e[1]&&this._scene?.updateTreeByOp({...t,path:[]},this._sharedAssetsManager)}}_findEntity(e){return this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e)}_resolveParentId(e){if(void 0===e)return this._scene.activePage.uuid;let t="string"==typeof e?e:e.uuid,n=this._findEntity(t);if(!n)throw new Error(`parent '${t}' — no object with that name or uuid in the scene.`);return n.uuid}async createCustomMaterial(e){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if("function"!=typeof e)throw new Error("createCustomMaterial: expected a factory function — createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let t=U();if(void 0===t&&("webgpu"===this._rendererBackend&&(await import("./runtime-webgpu-NLOKHPVE.js"),t=U()),void 0===t))throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline — pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let n=e(t);if("object"!=typeof n||null===n||!0!==n.isMaterial)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives — e.g. (three) => new three.MeshStandardNodeMaterial().");return n}async setMaterial(e,t){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let n=this._scene;if(!n)throw new Error("setMaterial: no scene loaded — call load() or start() first.");let r="string"==typeof e?e:e.uuid,i=this._findEntity(r);if(!i)throw new Error(`setMaterial: '${r}' — no object with that name or uuid in the scene.`);if(!(i instanceof W))throw new Error(`setMaterial: '${r}' is not a mesh — lights, groups, and cameras have no material.`);let s="function"==typeof t?await this.createCustomMaterial(t):t;if("webgpu"!==I())throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline — pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=In({material:s});if(void 0===a.material)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return i.setMaterialOverride(a.material,{scene:n,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(i.uuid),this._requestRenderAutoMode(),a.material}async createObject(e,t={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let n=this._scene,r=this._data;if(!n||!r)throw new Error("createObject: no scene loaded — call load() or start() first.");let i=function(e){if("string"!=typeof e||0===e.length)throw new Error(`createObject: expected a type name string — one of ${Gn}.`);let t=e.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),n=Kn[t];if(n)return{objectType:n};let r=Bn[t];if(r)return{objectType:"Mesh",geometryType:r};let i=Nn[t];throw i?new Error(`createObject: '${e}' is not supported — ${i}`):new Error(`createObject: '${e}' is not a creatable Spline type — use one of ${Gn}, e.g. createObject('Cube', { width: 200 }).`)}(e);"function"==typeof t.material&&(t={...t,material:await this.createCustomMaterial(t.material)});let s,a,{options:o,material:l}=In(t);if(void 0!==l){if("Mesh"!==i.objectType)throw new Error("createObject: a three.js material instance only applies to mesh types — lights and groups have no material.");if("webgpu"!==I())throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline — pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}if("TextGeometry"===i.geometryType){if(await import("./runtime-text-YREQB5BX.js"),!ce("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature — re-export the scene with a Text object present, or load the full runtime build.");if(await g(),a=t.font??Le,void 0===r.shared.fonts[a]){if(a!==Le){let e=Object.keys(r.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document — available fonts: ${e||"(none)"}.`)}s={name:Le,url:Ve}}}let c=this._resolveParentId(t.parent),h=Qn(i,o,r),d=Fe.generateUUID(),[u,p]=Ie(r);s&&(u.shared.fonts[Le]=s),u.scene.objects.insertAfter(c,null,[{id:d,data:h,children:[]}]);let m=p.result();if(s&&this._sharedAssetsManager.addFont(Le,s),void 0!==a){let e=this._sharedAssetsManager.getFont(a);e&&await e.loadingPromise}this._applyDocumentTransaction(m);let f=n.find(d);return void 0!==l&&f.setMaterialOverride(l,{scene:n,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(f)}cloneObject(e,t={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let n=this._scene,r=this._data;if(!n||!r)throw new Error("cloneObject: no scene loaded — call load() or start() first.");let i="string"==typeof e?e:e?.uuid,s=i?this._findEntity(i):void 0;if(!s)throw new Error(`cloneObject: '${i}' — no object with that name or uuid in the scene.`);if(s instanceof x)throw new Error("cloneObject: pages cannot be cloned.");let a=r.scene.objects.get(s.uuid);if(!a)throw new Error(`cloneObject: '${i}' is not part of the document tree (expanded clones and instanced children cannot be cloned — clone their source object instead).`);let o=function(e,t,n){let r={...e.data};return void 0!==t.position&&(r.position=Hn(t.position,[0,0,0])),void 0!==t.rotation&&(r.rotation=Hn(t.rotation,[0,0,0])),void 0!==t.scale&&(r.scale=Fn(t.scale)),void 0!==t.visible&&(r.visible=t.visible),r.name=t.name??er(`${e.data.name??"Object"} Copy`,n),{...e,data:r}}(nr(a),t,r.scene.objects),l=void 0!==t.parent?this._resolveParentId(t.parent):r.scene.objects.parent(s.uuid)??null,c=void 0!==t.parent?null:s.uuid,[h,d]=Ie(r);h.scene.objects.insertAfter(l,c,[o]),this._applyDocumentTransaction(d.result());let u=n.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(u)}removeObject(e){let t=this._scene,n=this._data;if(this.disposed||!t||!n)return!1;let r="string"==typeof e?e:e?.uuid,i=r?this._findEntity(r):void 0;if(!i)return!1;if(i instanceof x)throw new Error("removeObject: pages cannot be removed.");if("PerspectiveCamera"===i.data.type||"OrthographicCamera"===i.data.type)throw new Error("removeObject: cameras cannot be removed.");if(void 0===n.scene.objects.get(i.uuid))throw new Error(`removeObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let s=[];i.traverseEntity(e=>{s.push(e.uuid)});let[a,o]=Ie(n);a.scene.objects.delete(i.uuid),this._applyDocumentTransaction(o.result());for(let e of s){let t=this._proxyObjectCache.get(e);t&&(Kt.unsubscribe(t),this._proxyObjectCache.delete(e))}return this._requestRenderAutoMode(),!0}};export{cr as Application,Ne as Axis,ve as Easing,Pe as GradientType,pe as NoiseType,Se as PatternStyle,Oe as ProjectionType,_e as Side,Ce as TextureFilter,xe as ToonType,Ae as VoronoiStyle,Me as Wrapping};
|