Nonperturbative theory of spontaneous parametric down-conversion in open and dispersive optical systems