In accordance with section one hundred thirty-one-u of this chapter and the regulations of the office of children and family services, a social services district shall offer and provide necessary and available emergency shelter and services for up to ninety days at a residential program for victims of domestic violence to a victim of domestic violence who was residing in the social services district at the time of the alleged domestic violence whether or not such victim is eligible for public assistance. Two forty-five day extensions of necessary and available emergency shelter may be granted beyond the maximum length of stay at a residential program for victims of domestic violence for residents who continue to be in need of emergency services and temporary shelter.