"Window and doors are typically installed using one of two approaches: 1) barrier system installation or 2) a drained system installation.
Barrier installations do not provide for forgiveness to water infiltration through or around the window or door opening and should be limited to areas of low rainfall potential or areas where the area is protected (such as under overhangs or porches).
Drained installations are designed to manage small amounts of water infiltration through or around the window or door opening, by collect and draining the water back out to the exterior. Central to the performance of a drained opening is a pan flashing."
Unfortunately, most stucco homes built prior to 2015 lacked this important detail and as a result we are witnessing an epidemic of moisture damage in SE PA and DE.