How caldera collapse shapes the shallow emplacement and transfer of magma in active volcanoes